import os cmd = \'ipconfig /all\' #输入的命令 res = os.popen(cmd) output_str = res.read() # 获得输出字符串 print(output_str) 相关文章: