Python 3 renamed the
unicode type to
str, the old
str type has been replaced by
if isinstance(unicode_or_str, str): text = unicode_or_str decoded = False else: text = unicode_or_str.decode(encoding) decoded = True
Last but not least, you could just try to use the
2to3 tool to see how that translates the code for you.