7

In IDLE, print(chr(219)) (219's the block character) outputs "Û".

Is there any way to get it to output the block character instead?

This might actually be some sort of computer-wide problem, as I cannot seem to get the block character to print from anywhere, copying it out of charmap and into any textbox just results in the Û.

Zero Piraeus
  • 56,143
  • 27
  • 150
  • 160
Name McChange
  • 2,750
  • 5
  • 27
  • 46

2 Answers2

11

Use the correct character set.

3>> print(bytes((219,)).decode('cp437'))
█
3>> ord(bytes((219,)).decode('cp437'))
9608
3>> hex(9608)
'0x2588'
3>> print('\u2588')
█

Unicode Character 'FULL BLOCK' (U+2588)

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
0

Your python shell is probably using either ISO-8859-1 or Unicode, not he same character set as Character Map.

chr(219) is also U+00DB, which is probably the Unicode character Û. I don't know what character set you are using, but there aren't any symbol characters that early in the Unicode character set.

Ian Clelland
  • 43,011
  • 8
  • 86
  • 87