python call windows terminal command

python os

os模块调用cmd命令有两种方式:os.popen(), os.system(),都是用当前进程来调用;

os.system()无法获取返回值,

os.popen()带有返回值, recv = os.popen("ipconfig")  print(recv.read())

猜你喜欢

转载自blog.csdn.net/qq_42527487/article/details/83512780