常用属性

import sysprint(sys.argv)  # 命令行参数list,第一个元素是程序本身路径
print(sys.version)  # python解释器版本 3.4.1
print(sys.maxsize)  # 最大值 9223372036854775807
print(sys.path)  # 返回模块的搜索路径
print(sys.platform)  # 返回操作系统平台名称win32
sys.stdout.write("hello")
val = sys.stdin.readline()[:-1]
print("val",val)

help(sys)

Dynamic objects:

argv -- command line arguments; argv[0] is the script pathname if known
path -- module search path; path[0] is the script directory, else ''
modules -- dictionary of loaded modulesdisplayhook -- called to show results in an interactive session
excepthook -- called to handle any uncaught exception other than SystemExitTo customize printing in an interactive session or to install a customtop-level exception handler, assign other functions to replace these.stdin -- standard input file object; used by input()
stdout -- standard output file object; used by print()
stderr -- standard error object; used for error messagesBy assigning other file objects (or objects that behave like files)to these, it is possible to redirect all of the interpreter's I/O.last_type -- type of last uncaught exception
last_value -- value of last uncaught exception
last_traceback -- traceback of last uncaught exceptionThese three are only available in an interactive session after atraceback has been printed.

Static objects:

builtin_module_names -- tuple of module names built into this interpreter
copyright -- copyright notice pertaining to this interpreter
exec_prefix -- prefix used to find the machine-specific Python library
executable -- absolute path of the executable binary of the Python interpreter
float_info -- a struct sequence with information about the float implementation.
float_repr_style -- string indicating the style of repr() output for floats
hash_info -- a struct sequence with information about the hash algorithm.
hexversion -- version information encoded as a single integer
implementation -- Python implementation information.
int_info -- a struct sequence with information about the int implementation.
maxsize -- the largest supported length of containers.
maxunicode -- the value of the largest Unicode codepoint
platform -- platform identifier
prefix -- prefix used to find the Python library
thread_info -- a struct sequence with information about the thread implementation.
version -- the version of this interpreter as a string
version_info -- version information as a named tuple
dllhandle -- [Windows only] integer handle of the Python DLL
winver -- [Windows only] version number of the Python DLL
__stdin__ -- the original stdin; don't touch!
__stdout__ -- the original stdout; don't touch!
__stderr__ -- the original stderr; don't touch!
__displayhook__ -- the original displayhook; don't touch!
__excepthook__ -- the original excepthook; don't touch!

Functions:

displayhook() -- print an object to the screen, and save it in builtins._
excepthook() -- print an exception and its traceback to sys.stderr
exc_info() -- return thread-safe information about the current exception
exit() -- exit the interpreter by raising SystemExit
getdlopenflags() -- returns flags to be used for dlopen() calls
getprofile() -- get the global profiling function
getrefcount() -- return the reference count for an object (plus one :-)
getrecursionlimit() -- return the max recursion depth for the interpreter
getsizeof() -- return the size of an object in bytes
gettrace() -- get the global debug tracing function
setcheckinterval() -- control how often the interpreter checks for events
setdlopenflags() -- set the flags to be used for dlopen() calls
setprofile() -- set the global profiling function
setrecursionlimit() -- set the max recursion depth for the interpreter
settrace() -- set the global debug tracing function

Python编程:sys模块相关推荐

  1. python之sys模块详解_(转)python之os,sys模块详解

    python之sys模块详解 原文:http://www.cnblogs.com/cherishry/p/5725184.html sys模块功能多,我们这里介绍一些比较实用的功能,相信你会喜欢的,和 ...

  2. python中sys模块是什么意思_python之sys模块详解

    python之sys模块详解 sys模块功能多,我们这里介绍一些比较实用的功能,相信你会喜欢的,和我一起走进python的模块吧! sys模块的常见函数列表 sys.argv: 实现从程序外部向程序传 ...

  3. python中sys模块是什么内容_python中sys模块是做什么用的

    python中的sys是提供了一系列有关python运行环境的变量和函数的模块,如sys.argv函数实现从程序外部向程序传递参数:sys.platform函数用于获取当前系统平台. sys模块提供了 ...

  4. python中sys模块有问题_python中sys模块之输入输出错误流

    import sys sys.stdout.write("msg")   # 控制台白色字体打印 普通输出流 sys.stderr.write("msg") # ...

  5. python之sys模块详解

    sys模块功能多,我们这里介绍一些比较实用的功能,相信你会喜欢的,和我一起走进python的模块吧! sys模块的常见函数列表 sys.argv: 实现从程序外部向程序传递参数. sys.exit([ ...

  6. Python中sys模块详解

    sys.argv           命令行参数List,第一个元素是程序本身路径  sys.modules.keys() 返回所有已经导入的模块列表  sys.exc_info()     获取当前 ...

  7. python的sys模块有什么用_python sys模块详解

    Python sys 模块详解 1. 简介 "sys"即"system","系统"之意.该模块提供了一些接口,用于访问 Python 解释器 ...

  8. python中sys模块有什么用_Python sys模块用法详解

    sys 模块代表了 Python 解释器,主要用于获取和 Python 解释器相关的信息. 在 Python 的交互式解释器中先导入 sys 模块,然后输入 [e for e in dir(sys) ...

  9. python之sys模块【获取参数】

    sys模块:system指的是解释器(os指的是操作系统) 常用操作:用于接收系统操作系统调用解释器传入的参数 实验操作: 在python工具中敲入以下代码: import sys print(sys ...

  10. Python OS sys模块

    os模块(* * * *) os模块是与操作系统交互的一个接口 os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 os.chdir("dirname" ...

最新文章

  1. BrainNet:用于人与人之间直接协作的多人脑对脑接口
  2. Linux之编译安装MySQL
  3. ios APP开发简单实例
  4. Spring Boot文档阅读笔记-FileHandling解析及抓包分析
  5. Python中NotImplementedError的使用方法(抽象类集成子类实现)
  6. 使用Jquery中ajax实现上传文件
  7. poj1200 Crazy Search(hash)
  8. 机器学习-UCI数据集
  9. Selenium 2入门
  10. 计算机组装与维修第3版,计算机组装与维护(第3版)
  11. w10打游戏老是弹出计算机,有效解决win10玩游戏弹出输入法的问题
  12. SpringBoot中出现‘@‘ that cannot start any token. (Do not use @ for indentation)....
  13. ThinkPHP3.2短信验证码 (创蓝253短信验证码)
  14. 密码格式 数字+字母
  15. Python实例:七段数码管
  16. 零担物流单号查询方法,如何查自己的货到哪里了
  17. easypermission坑_Android 权限管理(原生、EasyPermissions、RxPermissions)-阿里云开发者社区...
  18. 2023年软考网络工程师考试备考指南
  19. hector-slam之杉川雷达配置过程
  20. java基础----数据类型

热门文章

  1. 上海交通大学,计算机考研情况如何?
  2. 识别产品外观的合格软件_机器视觉产品外观质量检测分析系统
  3. javascript/js匹配和图片的相互替换
  4. 为什么江西彩礼那么高呢?
  5. Sql Server 数据类型
  6. 学习方法 今天的收获
  7. python 调用pyautogui 实时获取鼠标的位置、移动鼠标
  8. 多层文件结构的CMakeList
  9. VSCode + CMakeList
  10. 从加密硬件开始,三未信安想在云时代转型云加密服务商