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

2 Answers 2

12

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)

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.