[Tutor] Changing the interpreter prompt symbol from ">>>" to ???

boB Stepp robertvstepp at gmail.com
Fri Mar 11 22:31:31 EST 2016


I must be bored tonight.  I have to confess that when copying and
pasting from the interpreter into a plain text email, I often find it
cluttered to confusing by all the ">>>..." that can result from nested
quoting.  So I poked around on the Internet and found that I can
temporarily change the prompt symbol using sys.ps1.  My initial trials
are:

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?

And a related question:  I often have the IDLE version of the Python
shell open.  How can I make this sort of change for IDLE?  I have done
some Googling on this as well, but haven't found the right search
query yet.  I also poked into some of the idlelib files, but so far
the only ">>>" I've found have been in specialized displays like IDLE
debug.

TIA!

-- 
boB


More information about the Tutor mailing list