Finding Python help...
Matt Gerrans
mgerrans at mindspring.com
Mon Mar 31 18:55:40 CEST 2003
> Eg. I wanted to find out how to get print to leave off the trailing
> newline. help(print) doesn't tell me:
I was a little perplexed by this when I first started with Python, too. I
wanted to print without the newline and without a space before the next item
(which you get when you put a comma at the end of the print statement).
The trick is to use sys.stdout.write(), which gives you the fine-grained
control you may be more accustomed to with printf or the like.
- Matt
More information about the Python-list
mailing list