Tagged Questions
0
votes
3answers
49 views
Print multiple variables in one line using python
I need some assistance with a python script. I need to search a dhcpd file for host entires, their MAC and IP, and print it in one line. I am able to locate the hostname and IP address but cannot ...
3
votes
4answers
54 views
What is the way to delete words in Python list which does not have numbers?
a = ['in 1978 by', 'History', 'members', 'albums', 'June 4th, 1979', 'October 7,1986): "The Lounge', 'In 1984 the', 'early 1990s; prominent']
the above list have words like history, members which ...
-1
votes
0answers
31 views
how extract important keywords from text including numbers?
I am using stemming and NLP methods to extract keywords from text file.
I got output keywords:
keywords = ['the lounge lizards', 'jazz', 'john lurie', 'musical', 'albums', 'bass guitar', 'drums', ...
0
votes
3answers
54 views
Extracting part of a string with irregular delimiters in python
I am wanting to extract the last part of the name of the file that is delimited by a constant prefix and '.csv'
Name of the file might look like:
constant_prefix_my file name.csv
or
...
0
votes
5answers
112 views
Why wont this regex match?
I have a file with the following format:
/* No comment provided by engineer. */
"Logout Successful!" = "Logout Successful!";
/* No comment provided by engineer. */
"London" = "London";
/* No ...
1
vote
0answers
56 views
Extracting paragraph from a Word document
I want to extract a paragraph from a Word document using regex. I'm currently using PyWin. Essentially the text goes like this:
3.4.3
Hello, me! I'm happy. Are you happy? Let's go look ...
0
votes
1answer
41 views
match numbers in multiple lines
I have an HTML text like this
<tr>
<td><strong>Turnover</strong></td>
<td width="20%" class="currency">£348,191</td>
...
1
vote
2answers
36 views
Translating regex match groups
I need to match name objects according to pdf file specification. However, names may contain hexadecimal digits (preceded by #) to specify special characters. I would like to translate these matches ...
1
vote
1answer
38 views
Python 3 replacement of string regex
I am working with a html script converted into a string
How do I replace all the html code in tags with blank using regex?
5
votes
5answers
61 views
How can I use regex to search inside sentence -not a case sensitive
I'm a newbie to Regular expression in Python :
I have a list that i want to search if it's contain a employee name.
The employee name can be :
it can be at the beginning followed by space.
...
0
votes
2answers
29 views
Calling a function on captured group in re.sub()
>>> base64_encode = lambda url : url.encode('base64').replace('\n', '')
>>> s = '<A HREF="http://www.google.com" ID="test">blah</A>'
>>> ...
2
votes
2answers
44 views
Re.sub in python not working
Suppose that:
s = '<A HREF="http://www.google.com" ID="test">blah</A>'
I want to prepend the url with "url: ", so I tried:
s = re.sub(r'href="([\w:/.]+)"', "url: " + r'\1', s, re.I)
...
0
votes
1answer
43 views
Lookbehind in python
Suppose I have:
string = "2 dogs. 4 cats. 9 horses. 7 goats"
I want to match every word that precedes a number.
I tried:
matches = re.search(r"(?<=\d+) \w+", string)
but it isn't working.
2
votes
2answers
39 views
Regex to read tags Python
I want to read elements within tags with regex, example:
<td>Stuff Here</td>
<td>stuff
</td>
I am using the following: re.findall(re.compile('<td>(.*)</td>'), ...
-1
votes
2answers
48 views
How to find the combination of words that includes all the letters in the input with Python
I want to find the most efficient way to loop through the combination of letters that are entered in Python and return a set of words whose combination includes all the letters, if feasible.
Example: ...