[Tutor] data type conversion for print statement
Tim
timmichelsen at gmx-topmail.de
Tue Sep 25 18:25:09 CEST 2007
Hello,
I have a print statement where I use concatenation of variables with "+" to
avoid extra whitespaces. The variables are mixed (float/int).
How can I convert them all to strings to have a clean print statement?
example
print str(var1)+"and this "+str(var2)+"needs to check "+str(var3)
how can I convert var1, var2, var3 all at once?
This would avoid errors because of mixed data types.
BTW, why does a statment like
print var1, var2
automatically add spaces between the variables?
Thanks in advance for your help.
Timmie
More information about the Tutor
mailing list