[Tutor] file read - rewind? (original) (raw)
vicki at thepenguin.org vicki at thepenguin.org
Mon Jul 26 18:06:57 CEST 2004
- Previous message: [Tutor] Reading in file and processing it in a thread
- Next message: [Tutor] file read - rewind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I want to read in a file, act on each line of the file, and then start at the beginning again. I don't see a rewind function in the fileinput module, yet it still does not work by simply executing the for line in inputfile again. What am I missing? The while loop should repeat until STOP_READ is set to TRUE.
--Vicki
STOP_READ = wx.FALSE
first_iteration = wx.TRUE
#While not STOP_READ, iterate through lines in file
while STOP_READ == wx.FALSE or first_iteration == wx.TRUE:
print "Got into while loop"
for line in input.readlines():
if len(line)>1:
first_iteration == wx.FALSE
tokens=line.split("|")
self.command = tokens[0][0]+tokens[0][1]
self.arguments =tokens[0].lstrip(tokens[0][0]+tokens[0][1]+" ") print self.command print self.arguments self.ProcessCommand(self.command, self.arguments) wx.GetApp().Yield()
- Previous message: [Tutor] Reading in file and processing it in a thread
- Next message: [Tutor] file read - rewind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]