Concatening string and integer

Pete Shinners pete at visionart.com
Thu Apr 27 13:49:13 EDT 2000


Paul Magwene wrote:
> 
> 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?
> 
> Use the str() function (one of the builtins), like so:
> 
> strTemp = "I make a test number: " + str(iMyNumber) + " once again"


you can also use the back ticks as a shortcut for the str()
builtin. you can do it like this;

strTemp = "I make a test number: " + `iMyNumber` + " once again"



More information about the Python-list mailing list