Beside casting it with str(), you can also use a format string: assert "%d" % 10 == "10" assert "%5d" % 10 == " 10" assert "%05d" % 10 == "00010"
In practice % supports a superset of what printf in C provides. Andreas Am Freitag, den 21.03.2008, 17:05 -0700 schrieb elis aeris: > how do I convert int to string? > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor