Concatening string and integer

JJ joacim at home.se
Thu Apr 27 10:09:30 EDT 2000


Thanks for all your fast answers

BR
Joacim

"Remco Gerlich" <scarblac-spamtrap at pino.selwerd.nl> wrote in message
news:slrn8gghgk.el7.scarblac-spamtrap at flits104-37.flits.rug.nl...
> JJ wrote in comp.lang.python:
> > 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?
>
> 1) You make a string of the integer:
>
> strTemp = 'I make test number: ' + str(iMyNumber) + ' once again'
>
> 2) You use string formatting:
>
> strTemp = 'I make test number: %d once again' % iMyNumber
>
> --
> Remco Gerlich,  scarblac at pino.selwerd.nl
> Hi! I'm a .sig virus! Join the fun and copy me into yours!





More information about the Python-list mailing list