strang thing:
守株待兔
1248283536 at qq.com
Tue Sep 6 04:18:41 EDT 2011
i found stange thing that i can't solve
import os
import csv
for name in os.listdir('/tmp/quote/'):
filename='/tmp/quote/'+name
file = open(filename,'r')
file.readline()
for row in csv.reader(file):
print row[0], row[1], row[2], row[3],row[4], row[5], row[6]
it's ok,
when i add (date,open,high,low,close,vol,adjclose) = (row[0], row[1], row[2], row[3],row[4], row[5], row[6])
change the code into
import os
import csv
for name in os.listdir('/tmp/quote/'):
filename='/tmp/quote/'+name
file = open(filename,'r')
file.readline()
for row in csv.reader(file):
(date,open,high,low,close,vol,adjclose) = (row[0], row[1], row[2], row[3],row[4], row[5], row[6])
print row[0], row[1], row[2], row[3],row[4], row[5], row[6]
the wrong output is :
file = open(filename,'r')
TypeError: 'str' object is not callable
i don't know why??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110906/a874345e/attachment.html>
More information about the Python-list
mailing list