To set the encoding to UTF-8 in Python, you can use the sys
module to set the default encoding. Here is how you can do it:
main.py55 chars4 lines
Alternatively, you can specify the encoding when you open a file using the io
module:
main.py127 chars5 lines
Remember, Python 3 strings are already unicode, so you don't need to worry about encoding for in-memory strings.
gistlibby LogSnag