ztlevi
7/12/2017 - 5:33 PM

ord() and chr() bin() and int()

ord() and chr() bin() and int()

ord(c)
# Given a string representing one Unicode character, 
# return an integer representing the Unicode code point of that character. 
# For example, ord('a') returns the integer 97 and ord('€') (Euro sign) returns 8364. 
# This is the inverse of chr().
chr(c)

b = bin(5)
# b = '0b101'
a = int('0b11111111', 2)
# a =255
a == 0b11111111
# True