[Tutor] Changing the interpreter prompt symbol from ">>>" to ???
boB Stepp
robertvstepp at gmail.com
Fri Mar 11 22:59:06 EST 2016
On Fri, Mar 11, 2016 at 9:31 PM, boB Stepp <robertvstepp at gmail.com> wrote:
> Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900
> 64 bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> sys.ps1 = '=>'
> =>sys.ps1 = chr(26)
> →sys.ps1 = chr(16)
> ►
>
> I personally like the last of these. My question is, will this show
> up as a black, filled-in arrowhead pointing to the right on everyone's
> email? I have yet to delve into Unicode display issues, but I have
> vague recollections that the old ASCII table values might not always
> display the same thing from one person's display to another one's. Is
> this correct?
There looks to be the potential for problems. I tried:
►for i in range(256):
... try:
... print(str(i) + ': ' + chr(i))
... except UnicodeEncodeError as e:
... print(e)
which gave in some sections:
126: ~
127:
'charmap' codec can't encode character '\x80' in position 5: character
maps to <undefined>
'charmap' codec can't encode character '\x81' in position 5: character
maps to <undefined>
So how reliable is the chr(16) character on people's displays?
boB
More information about the Tutor
mailing list