以下是我的代码:
import csv
csvfile = open("test.csv", "wb")
writer = csv.writer(csvfile)
writer.writerow([“Name”, "Age", "TelePhone"])
data = [
('XiaoMing', '25','1230123'),
('WangLing', '21', '2302310')
]
writer.writerows(data)
csvfile.close()
在python3.2.2下为何总提示如下错误:
Traceback (most recent call last):
File "C:/Python32/Maching_Learning_Text/test_csv.py", line 10, in
writer.writerow([1, 2, 3])
TypeError: 'str' does not support the buffer interface
Python读取CVS文件问题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-