Class data being zapped by method
Bruno Desthuilliers
onurb at xiludom.gro
Wed Aug 9 05:52:21 EDT 2006
Simon Forman wrote:
(snip)
> Not that this has anything to do with your actual question, but there
> are a number of small details that I noticed while reading your code:
>
>
> 2.) Reading lines from a file is better done like so:
>
> arrLines = open('datafiles/'+filename+'.tabdata').readlines()
Actually, it's better done like so:
fpath = os.path.join('datafiles', filename + ".tabdata")
f = open(fpath)
try:
process_opened_file(f)
finally:
f.close()
More information about the Python-list
mailing list