Concatening string and integer
Mikael Olofsson
mikael at isy.liu.se
Thu Apr 27 09:54:32 EDT 2000
On 27-Apr-00 JJ wrote:
> I want to concatenate a string containing both strings and integers like:
>
> strTemp = 'I make test number: ' + iMyNumber + ' once again'
>
> It doesn't work, how should I do this?
You need to convert the integer to a string, for instance as
strTemp = 'I make test number: ' + str(iMyNumber) + ' once again'
or as
strTemp = 'I make test number: %s once again'%iMyNumber
HTH
/Mikael
-----------------------------------------------------------------------
E-Mail: Mikael Olofsson <mikael at isy.liu.se>
WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone: +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date: 27-Apr-00
Time: 15:51:27
This message was sent by XF-Mail.
-----------------------------------------------------------------------
More information about the Python-list
mailing list