removing spaces when mixing variables / text

Paul Rubin http
Tue Feb 3 14:06:43 EST 2004


"tgiles" <tgiles at spam.kc.rr.com> writes:
> Everything is perfect with the glaring exeception of the output. It seems
> as if when one uses the "," in a print statement, you get an empty space
> in between variables and what I want there (namely, the ".").

Yeah, that's because of the somewhat un-Pythonic behavior of the print
statement, which inserts spaces around the printed items, and a newline
at the end.

> 	print a,".",b,".",c,".",d	

Try  
        print "%d.%d.%d.%d." % (a, b, c, d)



More information about the Python-list mailing list