【发布时间】:2014-08-09 06:35:39
【问题描述】:
我的以下代码运行良好,然后开始抛出此错误。我有一个 csv 文件,我正在尝试向其中写入一行。虽然其他解决方案涉及首先将内容转换为字节字符串,但由于我使用的是 csv,我不确定我能做到这一点。
代码:
def saveFile():
with open('data.csv','wb') as out:
csv_out=csv.writer(out)
csv_out.writerow(['Domain:','Mail Server:','TLS:','# of Employees:','Verified:'])
for row in root.pt.get_rows():
#csv_out.writerow(row)
print (row)
错误:
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1487, in __call__
return self.func(*args)
File "C:/Users/kylec/Desktop/DataMotion/Python/MailChecker.py", line 93, in saveFile
csv_out.writerow(['Domain:','Mail Server:','TLS:','# of Employees:','Verified:'])
TypeError: 'str' does not support the buffer interface
【问题讨论】: