I started to feel comfortable with Python until I came across some urwid tutorial that included an example with code like this
... main = urwid.Padding(menu(u'Pythons', choices), left=2, right=2) top = urwid.Overlay(main, urwid.SolidFill(u'\N{MEDIUM SHADE}'), align='center', width=('relative', 60), valign='middle', height=('relative', 60), min_width=20, min_height=9) urwid.MainLoop(top, palette=[('reversed', 'standout', '')]).run()
This u'\N{MEDIUM SHADE}' string literal drove me nuts almost all day until I found out that it was included - as comments! - in the files under /usr/lib/python3.5/encodings/ ... But nowhere have I found a hint of the use of such designations. I went through the Python documentation and found nothing. Even a hint!
Now I feel like n00b. Again. I believe that there are many more features that I have missed so much ... because they are not mentioned anywhere - or at least in an obvious and wonderful place.
Out of curiosity, I ran into my python interpreter:
print(u'\N{LOWER ONE QUARTER BLOCK}')
and i got
▂
Where does such black magic come from? I mean, where does this explain, can I use this ... notation (?) To print special characters using their friendly names? Does Python hide any other surprises like this?
python special-characters string-literals
user4113344
source share