converting an integer to a string
afriere at yahoo.co.uk
Wed Aug 6 08:32:26 CEST 2003
"Sean Ross" <sross at connectmail.carleton.ca> wrote in message news:<2AZXa.2573$_a4.492504 at news20.bellglobal.com>...
> "Ken Fettig" <kenfettig at btinet.net> wrote in message
> news:bgpl6401e66 at enews4.newsguy.com...
> > I have a quick simple question. How do you convert an integer to a string
> > Python?
> >>> 1
> >>> str(1)
Depending on where and why you want to convert it
>>> "%d" % 1
might be useful too.
>>> dat = (12, 'Spam Street')
>>> "%d %s" % dat
'12 Spam Street'
More information about the Python-list