unicode – Cant use unichr in Python 3.1

unicode – Cant use unichr in Python 3.1

In Python 3, you just use chr:

>>> chr(10000)
✐

In Python 3, theres no difference between unicode and normal strings anymore. Only between unicode strings and binary data. So the developers finally removed the unichr function in favor of a common chr which now does what the old unichr did. See the documentation here.

unicode – Cant use unichr in Python 3.1

Python 3.x doesnt have a special Unicode string type/class. Every string is a Unicode string. So… Id try chr. Should give you what unichr did pre-3.x. Cant test, sadly.

Leave a Reply

Your email address will not be published.