Can some please help in fixing the TypeError. It works in python 2 but not in python 3.
Python2:
def ExchangeColumns(RECXX_Output,Modified_Recxx_Output,column1,column2,column3,column4,column5,column6):
with open(RECXX_Output) as infile ,open(Modified_Recxx_Output, 'wb') as outfile:
reader = csv.DictReader(infile)
append = (column1,column2,column3,column4,column5,column6)
outfile.write(','.join(append)+'\n')
Python3:
def ExchangeColumns(RECXX_Output,Modified_Recxx_Output,column1,column2,column3,column4,column5,column6):
with open(RECXX_Output) as infile ,open(Modified_Recxx_Output, 'wb') as outfile:
reader = csv.DictReader(infile)
append = (column1,column2,column3,column4,column5,column6)
appendb = str.encode(append)
outfile.write(b','.join(appendb)+b'\n')
##outfile.write(b','.join(append).encode(encoding='utf-8')+b'\n')
The answer is in the question - You have a tuple object and not string.