No newline using printf
Gustavo 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