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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -