reading from a txt file

jrlen balane nbbalane at gmail.com
Tue Mar 29 22:36:58 EST 2005


how should i modify this data reader:
(assumes that there is only one entry per line followed by '\n')

data_file = open(os.path.normpath(self.TextFile.GetValue()), 'r')
data = data_file.readlines()
        
self.irradianceStrings = map(str, data)
self.irradianceIntegers = map(int, data)
self.IrradianceExecute.SetValue(''.join(self.irradianceStrings))



so that i can read the text file created by this:

self.filename = "%s\%s.txt"
%(os.path.normpath(self.SaveFolder.GetValue()),time.strftime("%Y%m%d%H%M"))

self.table_file = open(self.filename,"a")
self.table_file.write('%f\t'%self.temp11)
self.table_file.write('%f\t'%self.temp22)
self.table_file.write('%f\t'%self.pyra11)
self.table_file.write('%f\t'%self.pyra22)
self.table_file.write('%f\t'%self.voltage11)
self.table_file.write('%f\t'%self.current11)
self.table_file.write('\n')     
self.table_file.close()



More information about the Python-list mailing list