推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
Matrix24
V2EX  ›  Python

用 Python 脚本如何实现,启动 Python 脚本的脚本,例如在 shell 中执行 “python test.py”?

  •  
  •   Matrix24 · Feb 20, 2014 · 4114 views
    This topic created in 4612 days ago, the information mentioned may be changed or developed.
    就是用Python脚本写一个能够启动特定Python脚本的程序
    4 replies  •  1970-01-01 08:00:00 +08:00
    piglei
        1
    piglei  
       Feb 20, 2014
    一般来说,subprocess可以满足你的需求:

    # -*- coding: utf-8 -*-
    import subprocess

    subprocess.call('python another.py', shell=True)
    ritksm
        2
    ritksm  
       Feb 20, 2014
    ljcarsenal
        3
    ljcarsenal  
       Feb 20, 2014
    import os
    os.system('命令')
    PotatoBrother
        4
    PotatoBrother  
       Feb 20, 2014
    os库可以满足你
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5516 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 01:39 · PVG 09:39 · LAX 18:39 · JFK 21:39
    ♥ Do have faith in what you're doing.