python3 .encode() code example
Example: .encode python
string = 'pythön!'
print('The string is:', string)
string_utf = string.encode("utf-8")
print('The encoded version is:', string_utf)
# Output:
The string is: pythön!
The encoded version is: b'pyth\xc3\xb6n!'
# From: https://www.programiz.com/python-programming/methods/string/encode