评论
# re: Python 读写 Excel[未登录]
2013-12-14 18:44
xj
Traceback (most recent call last):
File "readExcel.py", line 10, in
print ','.join(values)
TypeError: sequence item 0: expected string, float found
回复 更多评论
# re: Python 读写 Excel[未登录]
2013-12-14 18:45
xj
楼主,按照你的那个代码貌似会报错:
python报错:
python readExcel.py
Sheet: 工作表1
c1,c2
Traceback (most recent call last):
File "readExcel.py", line 10, in
print ','.join(values)
TypeError: sequence item 0: expected string, float found
代码:
from xlrd import open_workbook
wb = open_workbook('testc12.xls','rb')
for s in wb.sheets():
print 'Sheet:',s.name
for row in range(s.nrows):
values=[]
for col in range(s.ncols):
values.append(s.cell(row,col).value)
print ','.join(values)
回复 更多评论