1

I have a simple syntax related question that I would be grateful if someone could answer. So I currently have character labels in a string format: '0941'.

To print out unicode characters in Python, I can just use the command:

print(u'\u0941')

Now, my question is how can I convert the label I have ('0941') into the unicode readable format (u'\u0941')?

Thank you so much!

2 Answers2

0
>>> chr(int('0941',16)) == '\u0941'
True
Błotosmętek
  • 12,717
  • 19
  • 29
-1

One way to accomplish this without fussing with your numeric keypad is to simply print the character and then copy/paste it as a label.

    >>> print("lower case delta: \u03B4")
    lower case delta: δ
    >>> δ = 42  # copy the lower case delta symbol and paste it to use it as a label
    >>> δδ = δ ** 2  # paste it twice to define another label. 
    >>> δ  # at this point, they are just normal labels...
    42
    >>> δδ
    1764
    >>> δabc = 737  # using paste, it's just another character in a label
    >>> δ123 = 456
    >>> δabc, δ123  # exactly like any other alpha character.
    (737, 456)