2015年9月26日星期六

Python参数说明

-B     Don't write .py[co] files on import. 不产生pyc或者pyo文件
-c     执行字符串参数 如 python -c "print 1"
-d     产生调试信息
-E     Ignore environment variables like PYTHONPATH and PYTHONHOME that modify the behavior of the interpreter. 忽略环境变量
-i     执行完脚本以后 会打开解释器 在调试时候使用比较好
-m     比如 python -m SimpleHTTPServer 8088 从sys.path找到一个模块然后执行模块代码
-O     基本优化 会丢掉docstring
-R     hash() 返回伪随机数
-Q     控制两个整数相除得到的类型 如 python -Q new -c "print 10/100"
-v     显示加载模块 如 python -v -c "print 1"
-s     Don't add user site directory to sys.path.
-S     Disable the import of the module site and the site-dependent manipulations of sys.path that it entails.
-t     检测tab和空格混用 给出警告
-u     Force  stdin,  stdout  and stderr to be totally unbuffered.  On systems where it matters, also put stdin, stdout and stderr in binary mode.  Note that there is internal buffering in xreadlines(), readlines()  and  file-object iterators  ("for line in sys.stdin") which is not influenced by this option.  To work around this, you will want
to use "sys.stdin.readline()" inside a "while 1:" loop.

强制 标准输入 标准输出 标准错误 无缓冲 在nohup python test.py中用比较好 如
nohup python -u script.py > log.log 2>&1 & 会把日志实时写入log.log 而不是等待缓冲区
满了再写入
-W    警告相关的参数