Line indexing in Python
seafoid
fitzpadj at tcd.ie
Fri Dec 18 11:35:16 EST 2009
Thanks for that Richard and Steve!
Below is my full code so far:
for line in file:
if line.startswith("1"):
a.write(line)
elif line.endswith("0"):
lists_a = line.strip().split()
print lists_a
elif line.startswith("2"):
lists_b = line.strip().split()
print list_a
Essentially, I want to read in a file and depending on location of 0, 1, 2,
write to another file or create lists.
The above passes without error warning but does nothing (semantic error?).
Any Suggestions?
Thanks in advance,
Seafoid.
--
View this message in context: http://old.nabble.com/Line-indexing-in-Python-tp26845253p26846049.html
Sent from the Python - python-list mailing list archive at Nabble.com.
More information about the Python-list
mailing list