Concatening string and integer

Paul Magwene paul.magwene at yale.edu
Thu Apr 27 09:55:59 EDT 2000


JJ wrote:
> 
> Hi!
> 
> 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?
> 
> BR
> Joacim


Use the str() function (one of the builtins), like so:

strTemp = "I make a test number: " + str(iMyNumber) + " once again"


--Paul



More information about the Python-list mailing list