File Parsing Question
Zentrader
zentraders at gmail.com
Wed Sep 12 18:02:05 EDT 2007
Save the previous line in a variable if you want the previous line
only.
for line in inp:
# Perform some operations with line
if condition something:
print prev_line
print line
break
# I need to go back one line and use that line value
--> prev_line = line
If you want to do more than that, then use data=inp.readlines() or you
can use
data = open(myfile), "r").readlines(). The data will be stored in
list format so you can access each line individually.
More information about the Python-list
mailing list