1string = "Hello World"
2
3# string with encoding 'utf-8'
4arr = bytes(string, 'utf-8')
5arr2 = bytes(string, 'ascii')
6
7print(arr,'\n')
8
9# actual bytes in the the string
10for byte in arr:
11 print(byte, end=' ')
12print("\n")
13for byte in arr2:
14 print(byte, end=' ')