Hi, new here! I'm a beginner in Python, and I've been looking through the Python Cookbook (2nd Edition) to learn how to process strings and characters.
I wanted to try converting a number into its Unicode equivalent. So I tried using the built-in function called 'unichr', which, according to the Cookbook, goes something like:
>>> print repr(unichr(8224))
... and will output:
u'\u2020'
However, the code failed. I thought it had something to do with print (because Python 3 uses print() instead of print ""), but that didn't work out as well. I tried several variations to the code, and it still failed. At long last, I just typed a simple line:
unichr(10000)
To my surprise, this error message kept popping up, no matter what value I put into the above function:
NameError: name 'unichr' is not defined
What could be the problem? Is there some specific module that I'm supposed to import?