Search code examples
pythontextunicodeexportxlrd

Printing unicode text with python


I have a dictionary that is filled with lists where the data was read from an excel file. All of the text is unicode however I do not have any special characters. I am trying to write the data that is located in the lists to a .txt file but I'm having trouble printing the lists out.

target.write("move % to 100 100") % product[1][0]
target.write("\n move % to 200 100") % product[1][1]
target.write("\n connect % to %") % (product[1][0], product[1][1])

product is the dictionary that holds the multiple lists. is there an easy way to format my .write statement so it can accept unicode. the error I'm getting is

"Type Error: unsupported operand type(s) for %: 'Nonetype' and 'unicode'

Solution

  • I'm an idiot just found out that I can type cast product so str(product[1][0]) accomplishes my needs