python – TypeError: expected a character buffer object
python – TypeError: expected a character buffer object
Assuming you just want to write the string 649
to the file, change row
to 649
or issue f.write(str(row))
.
You can do what timgeb did or you can do
row = str(649)
python – TypeError: expected a character buffer object
I had the same error, in my code:
s.translate(table)
The s
obj was string
. The issue was s.translate
was expecting a unicode string. So, the fix was to use:
unicode(s).translate(table)
Related posts on python :
- What are the two ways to create an empty dictionary in Python?
- How do I normalize data between 0 and 1 in Python?
- How do I remove text from a word in Python?
- What does triple quotes mean in Python?
- TypeError: iteration over a 0-d array Python
- python – How do I visualize a net in Pytorch?
- python – Max retries exceeded with URL in requests
- python – TypeError: can only concatenate list (not str) to list
- python – Trying to run Flask app gives Address already in use