Python - [编码]Python下的os.system调用cmd命令时遇到中文出现乱码的解决方法

区别:
◆使用Python的os.system运行CMD命令
◆使用Windows自带的命令行工具运行CMD命令

Python下的CMD:
在Python程序中添加以下代码,将当前CMD窗口的编码临时更改为utf-8

import os
os.system('chcp 65001')

猜你喜欢

转载自blog.csdn.net/caviar126/article/details/114122792
今日推荐