1# test builtin ord (whether or not we support unicode) 2 3print(ord('a')) 4 5try: 6 ord('') 7except TypeError: 8 print("TypeError") 9 10# bytes also work in ord 11 12print(ord(b'a')) 13print(ord(b'\x00')) 14print(ord(b'\x01')) 15print(ord(b'\x7f')) 16print(ord(b'\x80')) 17print(ord(b'\xff')) 18 19try: 20 ord(b'') 21except TypeError: 22 print("TypeError") 23 24# argument must be a string 25try: 26 ord(1) 27except TypeError: 28 print('TypeError') 29