I have the below code that was working fine and then started throwing this error. I have a csv file that I am trying to write one row to. While other solutions involve converting things to a byte string first, since I'm working with a csv, I'm not sure I can do that.
Code:
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)
Error:
Traceback (most recent call last):
File "C:Python34libkinter\__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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…