首页 > 代码库 > python之执行shell命令
python之执行shell命令
[root@s141 ~]# python Python 2.7.5 (default, Sep 15 2016, 22:37:39) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os #加载模块 >>> r=os.system >>> r("ls /root") #执行命令 anaconda-ks.cfg Music ceph-release-1-1.el7.noarch.rpm Pictures Desktop Public Documents Templates Downloads Videos epel-release-latest-7.noarch.rpm win_2008.qcow2 initial-setup-ks.cfg zabbix-agent-3.0.5-1.el7.x86_64.rpm 0
本文出自 “学习笔记” 博客,请务必保留此出处http://quliren.blog.51cto.com/9849266/1942725
python之执行shell命令
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。