How does one keep python from printing newline at program exit?

Mahesh Padmanabhan mahesh at privacy.net
Mon Oct 11 11:57:42 EDT 2004


S. Staats wrote:
> Good day, everbody.
> 
> Here is a simple program called test.py:
> #!/usr/bin/python
> print "No newline, please.",
> # End of program
> 
> Here is what program does:
> prompt> ./test.py
> No newline, please.
> 
> Here is what I want the program to do:
> prompt> ./test.py
> No newline, please.prompt>
> 
> How can I get the python interpreter to not print a newline when it exits?
> 
> Thanks for your help!

sys.stdout.write('No newline, please')



More information about the Python-list mailing list