Type Conversion in Python using ord() -
s = '4' c = ord(s) print ("after converting character integer : ",end="") print (c)
output: after converting character integer : 52
i don't understand value of output. can please explain why 52 printed?
if want become string integer need use int() function, ord() function returns integer representing unicode code point given unicode character.
example
s = '4' c = int(s) print ("after converting character integer : ",end="") print (c)
Comments
Post a Comment