Python-[Encoding] How to solve garbled Chinese characters when calling cmd command in os.system under Python

Differences:
◆Use Python's os.system to run CMD commands
◆Use the command line tool that comes with Windows to run CMD commands

CMD
under Python : Add the following code to the Python program to temporarily change the code of the current CMD window toutf-8

import os
os.system('chcp 65001')

Guess you like

Origin blog.csdn.net/caviar126/article/details/114122792