One of the biggest changes in Python 3 was Unicode.
Not gone talk about,better to show it.
Not gone talk about,better to show it.
# Python 3.6 language = 'หลาม' char = 'า' if char in language: #print('Yes {} is in {}'.format(char, language)) print(f'Yes {char} is in {language}') #The new way
Output:Yes า is in หลาม
In and out is utf-8 okay?>>> char = 'า' >>> char 'า' >>> e = char.encode() >>> e b'\xe0\xb8\xb2' >>> e.decode('utf-8') 'า'Yes it is,so out/in test.
language = 'หลาม' with open('thai.txt', 'w', encoding='utf-8') as f_out: f_out.write(language) with open('thai.txt', encoding='utf-8') as f_in: f = f_in.read() print(f) #--> หลาม