print without intervening space

Arne Koewing ark at gmx.net
Fri Aug 29 05:14:31 EDT 2003


eadorio at yahoo.com (Ernie) writes:

> Hi,
>
>>>> for x in range(10)
> ...   print x,
> ...
>
> will output 
>
> 0 1 2 3 4 5 6 7 8 9
>>>>
>
> What if somebody wants instead
>
> 0123456789
>
> Maybe we need a  printns (print with no spaces) ?

just use:

import sys
for x in range(10):
    sys.stdout.write(x)






More information about the Python-list mailing list