python调用CMD命令行

在Python里面经常需要调用CMD命令行,可以使用os.system模块。

import os
os.system("pause") # 暂停
os.system("ipconfig") # 查询ip
os.ysytem("d:\test.bat") # 指定路径调用bat批处理

总之,在cmd命令行的shell命令,在os.system中都可以实现哦!

猜你喜欢

转载自blog.csdn.net/qq_42833469/article/details/86689040