How to declare a string with special characters and convert it to a byte literal in Python

1 Answer

0 votes
s = 'Ύμνος - abc'
byte = s.encode('utf-8')

print(byte)




'''
run:

b'\xce\x8e\xce\xbc\xce\xbd\xce\xbf\xcf\x82 - abc'

'''

 



answered Apr 30, 2021 by avibootz
...