usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...

Options and arguments (and corresponding environment variables):

-B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x

-c cmd : program passed in as string (terminates option list)

-d : debug output from parser; also PYTHONDEBUG=x

-E : ignore PYTHON* environment variables (such as PYTHONPATH)

-h : print this help message and exit (also --help)

-i : inspect interactively after running script; forces a prompt even

if stdin does not appear to be a terminal; also PYTHONINSPECT=x

-m mod : run library module as a script (terminates option list)

-O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x

-OO : remove doc-strings in addition to the -O optimizations

-R : use a pseudo-random salt to make hash() values of various types be

unpredictable between separate invocations of the interpreter, as

a defense against denial-of-service attacks

-Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew

-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE

-S : don't imply 'import site' on initialization

-t : issue warnings about inconsistent tab usage (-tt: issue errors)

-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x

see man page for details on internal buffering relating to '-u'

-v : verbose (trace import statements); also PYTHONVERBOSE=x

can be supplied multiple times to increase verbosity

-V : print the Python version number and exit (also --version)

-W arg : warning control; arg is action:message:category:module:lineno

also PYTHONWARNINGS=arg

-x : skip first line of source, allowing use of non-Unix forms of #!cmd

-3 : warn about Python 3.x incompatibilities that 2to3 cannot trivially fix

file : program read from script file

- : program read from stdin (default; interactive mode if a tty)

arg ...: arguments passed to program in sys.argv[1:]

Other environment variables:

PYTHONSTARTUP: file executed on interactive startup (no default)

PYTHONPATH : ':'-separated list of directories prefixed to the

default module search path. The result is sys.path.

PYTHONHOME : alternate <prefix> directory (or <prefix>:<exec_prefix>).

The default module search path uses <prefix>/pythonX.X.

PYTHONCASEOK : ignore case in 'import' statements (Windows).

PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.

PYTHONHASHSEED: if this variable is set to 'random', the effect is the same

as specifying the -R option: a random value is used to seed the hashes of

str, bytes and datetime objects. It can also be set to an integer

in the range [0,4294967295] to get hash values with a predictable seed.

选项分类:

第一类: 执行方式

(1) -c: command, 执行命令

(2) -i: interactive, 执行交互

(3) -m: module, 执行模块

(4) file: 执行文件

(5) -: 执行流

(6) -d: debug模式

第二类: 源码编译

(1) -B: PYTHONDONTWRITEBYTECODE, 不保存编译后的字节码.

(2) -E: ignore PYTHON* environment.

(3) -O, -OO: PYTHONOPTIMIZE, optimize

(4) -s, -S: PYTHONNOUSERSITE, don't add user site, don't apply import site.

(5) -t, -tt: Tab与空格共用

(6) -x: skip x line

(7) -3: 兼容python3的方式

(8) -v:  PYTHONVERBOSE

第三类: 特性设置

(1) -R: hash()方法

(2) -Q: 除法

(3) -u: PYTHONUNBUFFERED

第四类: 其他:

(1) -h

(2) -V

python: 命令选项及归类的更多相关文章

  1. python命令行解析模块--argparse

    python命令行解析模块--argparse 目录 简介 详解ArgumentParser方法 详解add_argument方法 参考文档: https://www.jianshu.com/p/aa ...

  2. Python 命令行之旅 —— 初探 argparse

    『讲解开源项目系列』启动--让对开源项目感兴趣的人不再畏惧.让开源项目的发起者不再孤单.跟着我们的文章,你会发现编程的乐趣.使用和发现参与开源项目如此简单.欢迎联系我们给我们投稿,让更多人爱上开源.贡 ...

  3. 让你如绅士般基于描述编写 Python 命令行工具的开源项目:docopt

    作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...

  4. Python命令行参数解析模块getopt使用实例

    Python命令行参数解析模块getopt使用实例 这篇文章主要介绍了Python命令行参数解析模块getopt使用实例,本文讲解了使用语法格式.短选项参数实例.长选项参数实例等内容,需要的朋友可以参 ...

  5. python命令之m参数 局域网传输

    在命令行中使用python时,python支持在其后面添加可选参数. python命令的可选参数有很多,例如:使用可选参数h可以查询python的帮助信息: 可选参数m 下面我们来说说python命令 ...

  6. python命令之m参数

    在命令行中使用python时,python支持在其后面添加可选参数. python命令的可选参数有很多,例如:使用可选参数h可以查询python的帮助信息: 可选参数m 下面我们来说说python命令 ...

  7. 用什么库写 Python 命令行程序?看这一篇就够了

    作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...

  8. 在Python命令行和VIM中自动补全

    作者:gnuhpc 出处:http://www.cnblogs.com/gnuhpc/ 1. VIM下的配置: wget https://github.com/rkulla/pydiction/arc ...

  9. 9个 SSH常用命令选项

    9个 SSH常用命令选项 SSH 是什么 SSH(全称 Secure Shell)是一种加密的网络协议.使用该协议的数据将被加密,如果在传输中间数据泄漏,也可以确保没有人能读取出有用信息.要使用 SS ...

随机推荐

  1. BZOJ1002 轮状病毒

    Description 轮状病毒有很多变种,所有轮状病毒的变种都是从一个轮状基产生的.一个N轮状基由圆环上N个不同的基原子和圆心处一个核原子构成的,2个原子之间的边表示这2个原子之间的信息通道.如下图 ...

  2. 图的最短路算法 Floyd

    多源最短路径算法 时间复杂度O(N3) 简单修改可求有向图的传递闭包 #include<iostream> using namespace std; const int maxn=1024 ...

  3. Acronis Server备份Linux系统

    Acronis Server备份Linux系统 前段时间用Acronis Disk Director Suite解决了Thinkpad笔记本在win7的分区问题(http://chenguang.bl ...

  4. 【MariaDB】MariaDB的复制

    GTID的说明 官网:https://mariadb.com/kb/en/mariadb/global-transaction-id/ 官网:http://dev.mysql.com/doc/refm ...

  5. 【IHttpHandler】HttpModule的认识

    HttpModule是向实现类提供模块初始化和处置事件.当一个HTTP请求到达HttpModule时,整个ASP.NET Framework系统还并没有对这个HTTP请求做任何处理,也就是说此时对于H ...

  6. 020ARM家族

    1.名称:6410.2440.210.A8.ARM9.ARM11.armv7.ARMv6(v:vsersion) 芯片的名称:6410.210.2440都是属于芯片的名称,都是来自三星公司: ARM核 ...

  7. centos下网络的基本配置方法讲解

    上一篇中我们已经成功安装了我们的centos系统,但是我们可能发现我们安装的centos上不了网,所以这一章我们来说说如何配置centos来连接外网和局域网. 我们首先来认识一下linux下部分网络配 ...

  8. Spring web Flow2学习笔记

    想抽时间研究一下Spring web Flow2,能够找到的唯一电子书是<深入解析Spring+MVC与Web Flow>,我现在摘录本书的一段内容如下,通过这一段,大家可以想象中文背景的 ...

  9. luigi学习2-在hadoop上运行Top Artists

    一.AggregateArtistsHadoop class AggregateArtistsHadoop(luigi.contrib.hadoop.JobTask): date_interval = ...

  10. thinkphp二维数组模板输出方法

    thinkphp二维数组模板输出方法 先写个记录,有空再整理发上来