A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/307009.html below:

No newline using printf

No newline using printf No newline using printfGustavo Picon gpicon at aureal.com.pe
Thu Sep 15 20:50:23 EDT 2005
On Thu, 2005-09-15 at 17:37 -0700, Samuel wrote:
> Hello,
> 
> I have been searching for an answer for almost two hours now and have
> not found an answer. I want this code:
> 
> for i in range(3):
>   print i   # or whatever
> 
> To produce this output:
> 012
> 
> How can I print a word without appending a newline character? Appending
> a "," to the print statement only substitutes the newline for a space,
> which is not what I am looking for.
> 

Try with:

print ''.join(str(foo) for foo in range(3))


or sys.stdout.write 


-- 
Gustavo Picon (http://tabo.aurealsys.com/)
Aureal Systems S.A.C. (http://www.aureal.com.pe/)
gpicon at aureal.com.pe
Tlf: (511) 243-0131
Nextel: 9824*4625


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4