When you save an open file to a variable, you can re-use that variable
for membership checking.
it does not seem to be that way with the csv.reader function, even
when set to a variable name.
what is the best way to store the open CSV file in memory or do i need
to open the file each time?
example of open method on file object:
fhandle=open(fi lename).readeli nes()
example of csv.reader method:
reader = csv.reader(open (csvfilename))
here are my results:
.... print line
<lots of data on page...>
but when i try to iterate through it again, it appears to print
nothing (no error either). the file is exhausted?
.... print line
....
do i need to seek() the beginning of this file object ? any help is
greatly appreciated here.
for membership checking.
it does not seem to be that way with the csv.reader function, even
when set to a variable name.
what is the best way to store the open CSV file in memory or do i need
to open the file each time?
example of open method on file object:
fhandle=open(fi lename).readeli nes()
example of csv.reader method:
reader = csv.reader(open (csvfilename))
here are my results:
>>reader = csv.reader(open ('export.csv'))
>>for line in reader:
>>for line in reader:
<lots of data on page...>
but when i try to iterate through it again, it appears to print
nothing (no error either). the file is exhausted?
>>for line in reader:
....
do i need to seek() the beginning of this file object ? any help is
greatly appreciated here.
Comment