0
votes
1answer
15 views
pexpect parse a string
I have an expected string "Version 0.0.9999.0"
I do the spawn correctly then
e.expect('Version 0.0.9999.0')
and this works fine, however, I want to make it dynamic to accept any version (any 4 ...
1
vote
3answers
36 views
Check whether a string contains a numeric/digit/number in python
I have a string, and i need to check whether it contains a number/digit at the end of the string, and need to increment that number/digit at the end of the string with +1
I will get the strings as ...
0
votes
1answer
34 views
Extract Parts of HTML in Python [on hold]
I'm fairly new to python so not sure where to get started on this. Basically I've downloaded a webpage using wget. I need python to grab specific parts of this website. For example I have:
...
-2
votes
2answers
37 views
Trying to take the average of strings in a list and compare there counts in list to input file
My list is currently
['AA11','AA11','AA22','AA33','AA44','AA44']
These are values of mine that through functions I returned and they work, I have a (count) for len of my original data file(AA** 10 ...
0
votes
2answers
31 views
Capitalisation of First Letter of Each Word in a List; Bar All-Caps Words
I need to write a program that can capitalise each word in a sentence (which is stored as a list of words), without affecting the capitalisation of other parts of the sentence.
Let's say, for ...
3
votes
2answers
52 views
Python how to force one string to match format of another
I have a few Python scripts I have written for the Assessor's office where I work. Most of these ask for an input parcel ID number (this is then used to grab certain data through an odbc). They are ...
1
vote
1answer
38 views
How do i extract a list of elements encased in quotation marks bounded by <> and delimited by commas - python, regex?
Given a string like this:
ORTH < "cali.ber,kl", 'calf' , "done" >,\nLKEYS.KEYREL.PRED "_calf_n_1_rel",
With regex, how do I get a tuple that looks like the following:
('ORTH', ...
0
votes
3answers
40 views
Ignore punctuation and case when comparing two strings in Python
I have a two dimensional array called "beats" with a bunch of data. In the second column of the array, there is a list of words in alphabetical order.
I also have a sentence called "words" which was ...
2
votes
2answers
37 views
Python 3: Finding string in a list, returns the strings and NONE [duplicate]
Code:
def find(string_list, search):
new_list = []
for i in string_list:
if search in i:
new_list.append(i)
print(new_list)
print(find(['she', 'sells', 'sea', ...
4
votes
2answers
77 views
Python string to list best practice
I have a string like this "['first', 'sec', 'third']"
What would be the best way to convert this to a list of strings ie. ['first', 'sec', 'third']
1
vote
4answers
52 views
A more powerful method than Python's find? A regex issue?
I'm looking for a list of strings and their variations within a very large string.
What I want to do is find even the implicit matches between two strings.
For example, if my start string is ...
-3
votes
4answers
65 views
Parsing a string to extract a delimited unit having an alphabetic starting character and and an unknown length [on hold]
I'm new to python regular expression so any help will be appreciated. Thanks in advance.
I have this
string = "Restaurant_Review-g503927-d3864736-Reviews"
I would like extract 'g503927' and ...
1
vote
2answers
58 views
PYTHON : How to find block comments string in Python
I want to parse block comments in python. I order to do that I need to find comments section in .py file.
For example, my sample.py contains
'''
This is sample file for testing
This is sample file ...
0
votes
1answer
18 views
BOTO ResourceRecordSets object convert to string
How to convert an ResourceRecordSets to string ? I need to get like the blabla.lt, A, and 1.1.1.1 separately in strings.
It is on BOTO Route53.
Running on Ubuntu, Python 2.6.
-1
votes
1answer
45 views
Python treat variable as literal/raw string [on hold]
I can't believe it's that difficult to treat a variable as a raw string! I have searched and found questions alike, but no proper answer.
I have a variable with domain name stored in. e.g. ...