Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: How to print a 'block' using ASCII #219 in Mac

I use python on Mac OS X, and I want to use an extended ASCII symbol #219 like in this table :

https://theasciicode.com.ar/extended-ascii-code/block-graphic-character-ascii-code-219.html

The problem, I found out that 'block' character doesn't exist in Mac ASCII... I'm not sure.

Can anyone help me? I was trying to print using unichr(219), but it was giving me different result. It will output Û. What i want is

like image 859
andio Avatar asked Nov 29 '22 02:11

andio


1 Answers

the corresponding unicode character is 0x2588, so use that:

print unichr(0x2588)        # or:
print u"\u2588"

should give you the right result. if you want it in a different encoding, you can always encode it.

like image 105
mata Avatar answered Dec 17 '22 10:12

mata