I am trying to upgrade my code to python 3. Having some trouble with this line,
output_file = open(working_dir + "E"+str(s)+".txt", "w+")
output_file.write(','.join(headers) + "\n")
and get this error TypeError: sequence item 0: expected str instance, bytes found
What i've tried,
output_file.write(b",".join(headers) + b"\n")
TypeError: write() argument must be str, not bytes
ive also tried using decode()
on the join, also tried using r
and w+b
on open.
How can i convert to str
in python 3?