IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Python:查看某个目录下的内容

    Adamhuan发表于 2017-05-12 06:51:12
    love 0

    代码:

    [root@oracle-cluster-3 ~]# python
    Python 2.7.5 (default, May  8 2014, 17:35:19) 
    [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import subprocess
    >>> subprocess.call(["ls","-l","/script/"])
    total 4
    drwxr-xr-x 2 root root   42 May 12 10:53 python
    drwxr-xr-x 2 root root 4096 Apr 26 17:20 shell
    0
    >>>

    ——————————————————
    Done。



沪ICP备19023445号-2号
友情链接