ValueError: I/O operation on closed file
San
santanu01 at gmail.com
Thu May 26 01:47:42 EDT 2016
On Wednesday, May 25, 2016 at 6:00:07 PM UTC+5:30, San wrote:
> Hi Gorup,
>
> why i am getting "ValueError: I/O operation on closed file" this error.
> Pls let me know.
>
> Thanks in Advance.
> san
Hello,
Following is the code i used.
def test_results(filename):
import csv
with open(filename,"rU") as f:
reader = csv.reader(f,delimiter="\t")
result = {}
for row in reader:
key = row[0]
if key in result:
result[row[0]].append(row[1])
else:
result[row[0]] = key
result[key]=row[1:]
print result
filename ='filename.csv'
test_results(filename)
More information about the Python-list
mailing list