[Tutor] Looking for Python equivalents of some C functions
Sean 'Shaleh' Perry
shalehperry@attbi.com
Fri Feb 7 03:14:01 2003
On Thursday 06 February 2003 23:19, Tony Cappellini wrote:
> Are there Python equivalents for the following C functions ?
>
> sprintf()
> fprintf()
>
import sys
sys.stderr.write("My name is %s" % name)
# equiv of fprintf(stderr, "My name is %s", name);
name =3D "%s, %s" % (last_name, first_name)
# equiv of sprintf(name, "%s, %s", last_name, first_name);
> I didn't see anything suitable in the strings module references.
>
> itoa()
> ltoa()
> ftoa() // float or double to asciii
>
str(), int(), float() will do that conversions you want.