[Tutor] unicode question
Alex Kleider
alexkleider at gmail.com
Mon Jun 6 16:04:32 EDT 2022
I've been playing around with unicode a bit and found that the
following code doesn't behave as I might have expected:
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("\N{middle dot}")
·
>>>
>>> middle_dot = '0140', '013F', '00B7', '2027'
>>> ucode = ['\\u' + dot for dot in middle_dot]
>>> for dot in ucode:
... print(dot)
...
\u0140
\u013F
\u00B7
\u2027
>>> print("\u0140")
ŀ
>>> print("\u013f")
Ŀ
>>> print("\u00b7") # the one I want
·
>>> print("\u2027")
‧
>>>
I was expecting the for loop to output the same as the last four print
statements but, alas, not so.
Comments would be welcome.
Sincerely,
Alex
--
alex at kleider.ca (sent from my current gizmo)
More information about the Tutor
mailing list