You can import sys in python. Then use sys.getdefaultencoding() to see what the default encoding of your python is. Anyway, my default is ascii... By the way, I used the lines of your code on Ubuntu yesterday, and the Chinese output to the command line is still garbled... slightly Weird... In the end, I processed Chinese directly in the file
The above one refers to the encoding of this file. The root python sys has nothing to do with it.
Why we need sys.setdefaultencoding(“utf-8”) in a py script?
You can import sys in python. Then use sys.getdefaultencoding() to see what the default encoding of your python is. Anyway, my default is ascii...
By the way, I used the lines of your code on Ubuntu yesterday, and the Chinese output to the command line is still garbled... slightly Weird... In the end, I processed Chinese directly in the file