[Tutor] Very simple question

Alan G alan.gauld at freenet.co.uk
Wed Aug 17 18:41:51 CEST 2005


Hi Jack,

Welcome to tutor...

> i am just starting out with python and have already hit a problem!
> howdo you create a new line!  i have tryed tab etc and enter runs 
> the
> command. Please help

The >>> prompt executes commands as you type them. It is only meant
for experimenting and finding out how commands work. If you want to
write a full program in Pytthon you need to create a new text file
with a name ending in .py. You can then double click that file and
python will run it for you. Sometuimes it ruins too fast so you
might want to add the line

raw_input('Hit enter to close...')

at the end.

This is explained in my tutorial at the end of the Coding Style
topic. The faxct that I don;t introduce it till so late tells
you how much you can learn from the >>> prompt!

BTW If you really do need to continue a line at the >>> prompt
because its too long or something you can use a \ character,
like so:

>>> print "Here is a split \
... line"
Here is a split line
>>>

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld 



More information about the Tutor mailing list