Search code examples
pythonmacosextended-ascii

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


Solution

  • 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.