快捷搜索:  汽车  科技

pycharm执行选中的代码(PyCharm执行os.popen)

pycharm执行选中的代码(PyCharm执行os.popen)File->Settings->Editor->File Encodings 把 Global Encoding 设置成 GBK 即可。运行成功

执行代码

import os deviceName = os.popen('adb shell getprop ro.product.model').read() print(deviceName) platformVersion = os.popen('adb shell getprop ro.build.version.release').read() print(platformVersion) device = os.popen('adb shell getprop ro.product.name ').read() print(device)

执行结果出现以下乱码情况:

pycharm执行选中的代码(PyCharm执行os.popen)(1)

解决办法

修改 PyCharm 配置:

File->Settings->Editor->File Encodings

把 Global Encoding 设置成 GBK 即可。

运行成功

猜您喜欢: