Strange
Strange

Reputation: 309

Printing non ASCII glyphs in python

In HTML-CSS, we put non-ascii glyphs like middle dots, copyright symbol etc, by using their numeric conventions. In order to use non-ASCII characters, Python requires explicit encoding and decoding of strings into Unicode.

I have tried using unidecode lib (from reference here), but I am having trouble printing these characters.

I have tried different conventions for the symbol: U+25CF , ● [&#9679 with ';'] , and so on... (depending on variation of these glyphs)n For example sake, help me print same dot(above) in python

I want to know how to print these in python, for I have such requirement in a GUI project, made with kivy/kivymd in python.

Upvotes: 0

Views: 157

Answers (1)

Mark Ransom
Mark Ransom

Reputation: 308111

print(chr(9679))

Just use the decimal part of the entity.

Using a special escape sequence you can embed the character in a string using the hex.

print('\u25cf')

Upvotes: 1

Related Questions