python: 命令选项及归类
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: 命令选项及归类的更多相关文章
- python命令行解析模块--argparse
python命令行解析模块--argparse 目录 简介 详解ArgumentParser方法 详解add_argument方法 参考文档: https://www.jianshu.com/p/aa ...
- Python 命令行之旅 —— 初探 argparse
『讲解开源项目系列』启动--让对开源项目感兴趣的人不再畏惧.让开源项目的发起者不再孤单.跟着我们的文章,你会发现编程的乐趣.使用和发现参与开源项目如此简单.欢迎联系我们给我们投稿,让更多人爱上开源.贡 ...
- 让你如绅士般基于描述编写 Python 命令行工具的开源项目:docopt
作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...
- Python命令行参数解析模块getopt使用实例
Python命令行参数解析模块getopt使用实例 这篇文章主要介绍了Python命令行参数解析模块getopt使用实例,本文讲解了使用语法格式.短选项参数实例.长选项参数实例等内容,需要的朋友可以参 ...
- python命令之m参数 局域网传输
在命令行中使用python时,python支持在其后面添加可选参数. python命令的可选参数有很多,例如:使用可选参数h可以查询python的帮助信息: 可选参数m 下面我们来说说python命令 ...
- python命令之m参数
在命令行中使用python时,python支持在其后面添加可选参数. python命令的可选参数有很多,例如:使用可选参数h可以查询python的帮助信息: 可选参数m 下面我们来说说python命令 ...
- 用什么库写 Python 命令行程序?看这一篇就够了
作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...
- 在Python命令行和VIM中自动补全
作者:gnuhpc 出处:http://www.cnblogs.com/gnuhpc/ 1. VIM下的配置: wget https://github.com/rkulla/pydiction/arc ...
- 9个 SSH常用命令选项
9个 SSH常用命令选项 SSH 是什么 SSH(全称 Secure Shell)是一种加密的网络协议.使用该协议的数据将被加密,如果在传输中间数据泄漏,也可以确保没有人能读取出有用信息.要使用 SS ...
随机推荐
- linux配置tns
.三个配置文件都是放在$ORACLE_HOME\network\admin目录下. .sqlnet.ora确定解析方式 .listener.ora上设SID_NAME,通常用于JDBC访问,对应的错误 ...
- php中未定义变量的使用
在php中,若变量$test没有定义,则: empty($test)返回true: !empty($test)返回false: 具体可参考http://www.jb51.net/article/246 ...
- 【Qt 】QSettings写ini配置文件
QSettings写ini配置文件(Qt版本5.2): #include "inidemo.h" #include <QSettings> #include <Q ...
- 2016.04.09 使用Powerdesigner进行创建数据库的概念模型并转为物理模型
2016-04-09 21:10:24 本文原创受版权保护,严禁转载. 请大家不要用于商业用途,支持正版,大家都是做软件的,知道开发一套软件实属不易啊! 今天看到了一个很有趣并且很有用的辅助 ...
- MySQL的存储引擎整理
01.MyISAM MySQL 5.0 以前的默认存储引擎.MyISAM 不支持事务.也不支持外键,其优势是访问的速度快,对事务完整性没有要求或者以SELECT.INSERT 为主的应用基本上都可以使 ...
- java Literals
Primitive Data Types The Java programming language is statically-typed, which means that all variabl ...
- 最简洁粗暴版的虚拟用户配置FTP
最简洁粗暴版的虚拟用户配置FTP yum安装FTP: yum install vsftpd pam* db4* -y 设置为系统服务:chkconfig –level 35 vsftpd on 2.v ...
- PHPExcel上传sae遇到: -1:fail to get xml content
在用PHPExcel1.8.0来处理excel时,本地测试时好使的,但是要把代码部署到SAE,在上传代码的时候就会遇到这个问题. 部署代码中遇到问题: -1:fail to get xml conte ...
- GoLang安装
GoLang的官网被墙,镜像下载地址:http://tip.golang.so/dl/ 或者 http://golang.so/dl/ 安装说明:http://tip.golang.so/doc/i ...
- mysql连接查询经典小例题
mysql连接查询: Mysql连接查询支持多表连接 对同一张表可以重复连接多次(别名在多次连接同一张表时很重要) 例题1: 下面有2张表 teams表 比赛结果表:result 问题: 得出一张表: ...