Home > Backend Development > Python Tutorial > Python 命令行参数sys.argv

Python 命令行参数sys.argv

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 11:27:07
Original
1287 people have browsed it

Python代码:

import os, sys
os.system(sys.argv[
1])
带参数执行 python xxx.py spe
os.system 是用来执行命令行的。因此该程序会接收到第一个参数spe,然后在命令行里执行spe,这样,spe(Python IDE)就打开了。
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template