>>> sys.path
['', '/usr/local/python35/lib/python35.zip', '/usr/local/python35/lib/python3.5', '/usr/local/python35/lib/python3.5/plat-linux', '/usr/local/python35/lib/python3.5/lib-dynload', '/usr/local/python35/lib/python3.5/site-packages']
#!/usr/bin/env python35
import sys
f = open('log.txt','a') #以追加的模式打开一个文件
__console__ = sys.stdout #备份默认console命令行
sys.stdout = f #指定标准输出到文件
print('hello python')
sys.stdout = __console__ #将标准输出改为模式的console命令行模式
print('hello world') #输出将会在console命令行下
[root@python python]# python35 stdout.py
hello world
[root@python python]# cat log.txt
hello python
#!/usr/bin/env python35
import sys
name = sys.stdin.readline() #接受标准输入,等价于raw_input()
print('输出:',name)
>>> sys.exec_prefix
'/usr/local/python35'
>>> sys.byteorder
'little'
>>> sys.copyright
'Copyright (c) 2001-2017 Python Software Foundation.\nAll Rights Reserved.\n\nCopyright (c) 2000 BeOpen.com.\nAll Rights Reserved.\n\nCopyright (c) 1995-2001 Corporation for National Research Initiatives.\nAll Rights Reserved.\n\nCopyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\nAll Rights Reserved.'