I am porting my code to python 3 with maintaining backwards compatibility.
The str
function in python 2 and python 3 convert strings with non-ascii characters differently. For example:
Python 2:
In [4]: str('Alnus viridis (Chaix) DC. ssp. sinuata (Regel) A. Löve & D. Löve')
Out[4]: 'Alnus viridis (Chaix) DC. ssp. sinuata (Regel) A. L\xc3\xb6ve & D. L\xc3\xb6ve'
But in Python 3:
In [1]: str('Alnus viridis (Chaix) DC. ssp. sinuata (Regel) A. Löve & D. Löve')
Out[1]: 'Alnus viridis (Chaix) DC. ssp. sinuata (Regel) A. Löve & D. Löve'
Python 3 How can I get the same representation in Python 2? I am writing the strings to a sqlite3 table.