0

Ok i know how to create string.

but what is the meaning of this str (12).

1st Jan 2017, 7:12 PM
stephen haokip
stephen haokip - avatar
2 Answers
+ 4
what str(12) does is convert 12 from a integer to a string. so it will go from 12 to '12'
1st Jan 2017, 7:26 PM
numan
numan - avatar
0
" ...Return a string version of object. If object is not provided, returns the empty string. Otherwise, the behavior of str() depends on whether encoding or errors is given, as follows... " 4.7. Text Sequence Type — str ex: x = str(42343) y = str() z = str(13) print(x,y,z) print(x+y+z) result: >> 42343 13 4234313 https://docs.python.org/3/library/stdtypes.html#str
12th Feb 2017, 6:08 PM
Eduardo H.P Souza
Eduardo H.P Souza - avatar