how to print without blank?
Ivan Herman
ivan at ivan-herman.net
Sun Apr 9 02:30:19 EDT 2006
Ju Hui wrote:
> I want to print 3 numbers without blank.
>>>> for x in range(3):
> ... print x
> ...
> 0
> 1
> 2
>>>> for x in range(3):
> ... print x,
> ...
> 0 1 2
>
> how to print
> 012
> ?
>
> thanks.
>
You may want to use the write command with stdout:
sys.stdout.write("%s" % x)
using 'write' you have much more facilities to format the output...
I hope this helps
Ivan
More information about the Python-list
mailing list