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. C# Exception 对象的属性

    关于 C# 中 Exception 对象的属性,在程序出现异常时,需要记录异常的信息,并把信息保存起来或输出,以方便准确定位异常的根源,以下是 Exception  对象的属性 名称          ...

  2. procfs

    https://www.kernel.org/doc/Documentation/filesystems/proc.txt /proc/stat cpu 493610 1050 955506 6140 ...

  3. Microsoft Dynamics AX 2012 X++ Editor Extensions

    Microsoft Dynamics AX 2012 X++ Editor Extensions Initial version of this project is based on the MSD ...

  4. ASP.NET MVC学习1

    ViewBag是一个dynamic(动态类型)类型集合,可以动态添加任何类型的任意名称的属性和值,ViewBag是Controller和view之间传递数据的,如以下: ViewBag.HtmlStr ...

  5. MySQL 使用方法简单教程

    1.启动MySQL服务器实际上上篇已讲到如何启动MySQL.两种方法:一是用winmysqladmin,如果机器启动时已自动运行,则可直接进入下一步操作.二是在DOS方式下运行 d:/mysql/bi ...

  6. Oracle笔记 八、PL/SQL跳转/判断/循环语句块

    --goto跳转语句 --在goto 后,跳转到相应的语句,然后执行该语句和后面所有语句 begin dbms_output.put_line('goto开始了'); goto c; --不被执行 d ...

  7. webGL 学习教程

    ====教程=================== webGL中文网:http://www.hewebgl.com/webGL API:https://developer.mozilla.org/en ...

  8. 解决 FastReport 使用存储过程 找不到临时表问题

    在存储过程最开始加入:以下命令就可以了 SET FMTONLY OFF 有时候在执行SQL查询语句时,仅仅需要知道检索的元数据,而不是具体的数据行,可以设置SET FMTONLY ON. SET FM ...

  9. Solaris进程管理

    ps-a    列出与终端有关的进程-e    列出所有进程-A    同-e-f      列出进程完整信息-l      生成一个长列表-u username 列出某用户的进程 常用:ps -ef ...

  10. 无DLL远程注入

    界面如下: 主要代码如下: #define STRLEN 20 typedef struct _DATA { DWORD dwLoadLibrary; DWORD dwGetProcAddress; ...