Reputation: 20884
How would you list all PUA unicode character codes in a list in python?
I was playing around with chr()
and defaultdict(list)
. I couldn't figure how to list them all.
Upvotes: 0
Views: 999
Reputation: 1123620
Just use a range; the codepoints for the Private Use Areas of the BMP are all codepoints between (hex) E000 and F8FF:
pua = [chr(i) for i in range(0xE000, 0xf900)]
for Python 3.
Python 2 version, using the unichr()
function:
pua = [unichr(i) for i in xrange(0xE000, 0xf900)]
Upvotes: 4