[Tutor] problem with Python Tutorial
Dick Moores
rdm at rcblue.com
Tue Aug 9 01:33:05 CEST 2005
Quoting from "6.2 Standard Modules", of the Python Tutorial
(<http://www.python.org/doc/2.4/tut/node8.html#SECTION008200000000000000000>):
==================================
One particular module deserves some attention: sys, which is built into
every Python interpreter. The variables sys.ps1 and sys.ps2 define the
strings used as primary and secondary prompts:
>>> import sys
>>> sys.ps1
'>>> '
>>> sys.ps2
'... '
>>> sys.ps1 = 'C> '
C> print 'Yuck!'
Yuck!
C>
These two variables are only defined if the interpreter is in interactive
mode.
========end of quote===================
I tried this with IDLE:
>>> import sys
>>> sys.ps1
Traceback (most recent call last):
File "<pyshell#27>", line 1, in -toplevel-
sys.ps1
AttributeError: 'module' object has no attribute 'ps1'
>>> sys.ps2
Traceback (most recent call last):
File "<pyshell#28>", line 1, in -toplevel-
sys.ps2
AttributeError: 'module' object has no attribute 'ps2'
What's wrong?
Thanks,
Dick Moores
More information about the Tutor
mailing list