Newbie: Casting Int to string....

Sean 'Shaleh' Perry shaleh at valinux.com
Thu Mar 1 18:18:17 EST 2001


On 01-Mar-2001 Digital Hyakugei wrote:
> Ok, pretty simple, no? I can not find out how to do the following...
> 
> i've got a variable:
> 
> aNumber = 1
> 
> Now i have a function
> 
> nntp.stat( aVal )
> 
> where aVal has to be a string.
> 
> I cant do
> 
> nntp.stat( aNumber )
> 
> cuz it expects a string, not an int.
> 
> How, oh how, do i cast an int to a string?
> I'm sure its something that is forehead slapping obvious, but i just cant
> seem to find it...
> 

str(foo) or '%s' % foo.  Both work.




More information about the Python-list mailing list