About printing in IDLE?

Dustan DustanGroups at gmail.com
Fri Mar 10 01:13:36 CET 2006


Dr. Pastor wrote:
> Installed Python 2.4.2 on Windows XP.
> Activated IDLE.
> Loaded the following to the Edit window:
> ---
> print "hello world"
> for i in range(10):
>          print i,
>
> print "Done"
> ---
> It prints as: 0 1 2 3 4 5 6 7 8 9 Done
> Should not Done be printed on a new line alone?
> Thanks for any guidance.

the comma after print i means the next print statement will print on
the same line. It prints 9, an then the next print statement is "Done".
It prints on the same line. If you want it on a newline, try:

print "\nDone"




More information about the Python-list mailing list