+ 6
Covert Number to string?
How can i convert numbers to strings in python
5 Respuestas
+ 19
Just use the built-in str() function. So str(142) is "142"
+ 3
num=123 #convert 123 to string
str(num)
>> '123'
nuM='1234' #convert '1234' to number
int(nuM)
>> 1234
+ 3
You can use for example:
str(112) to convert an number to a string...
+ 2
num = 1337
str(num)
>> "1337"
#convering and checking the type
num = str(num)
type(num)
>> str
+ 2
It's easy just use the str function. For example:
str(123) = "123"
You can, in the same way use, the int, list, float etc function to convert the object into a integer, list, float etc...