Newbie: searching a list
user
user at comm.mot.com
Wed May 23 12:18:53 EDT 2001
I have a list generated from a "sentence=split(some_file.readline())"
statement.
A sample list resulting from this statement is:
['Independent', 'Variable', '=', '11', ';']
I want to extract the '11', which is the next item in the list following
the equals sign; I thought to get it this way:
found=0
IV=''
for item in sentence:
if found:
IV=item
break
if item == "=":
found=1
This works, but is it the best way to do it?
-- Stephen
More information about the Python-list
mailing list