2020
11-06
11-06
Python常用外部指令执行代码实例
1、os.system()阻塞屏幕会打印命令的输出返回命令结果码#-*-encoding=utf-8-*-importosif__name__=='__main__':passprint('开始')ret1=os.system('python')print('ret1:{}'.format(ret1))ret2=os.system('java-version')print('ret2:{}'.format(ret2))print('结束')运行可能有人理解阻塞是因为运行了python,因此我尝试两个命令都用java-version#-*-encoding=utf-8-*-importosif__name__=='__ma...
继续阅读 >