What am I doing wrong?

Peter Hansen peter at engcorp.com
Thu May 30 22:12:04 EDT 2002


Banar-Tul wrote:
> 
>     I am just starting with Python an I am running into a head stratching
> delima. I am using SuSe 7.3 Pro with Python 2.1.1.  I start Python by
> typing python at the following prompt.
> 
>         user at linux:~> python
> 
>     From there I can work interactively such as;
> 
>        >>> print "Hello World"
>            Hello World
> 
> But I am trying to follow the examples in Learning Python which instructs
> 
>            % cat threenames.py
>             [example code]
> 
> but the only prompt I get is the >>>. 

That's because you are still in the Python console.  The example
above is expecting to be typed at the _shell prompt_.  The "%" prompt
is an indicator that you should exit Python with Ctrl-D and type
the Linux command "cat" which simply displays the contents of the
file named 'threenames.py'.

>>> indicates the Python prompt
% indicates a Linux prompt

-Peter



More information about the Python-list mailing list