码迷,mamicode.com
首页 > 编程语言 > 详细

进阶第十二课 Python模块之sys

时间:2018-03-31 16:42:03      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:git   cst   sys.argv   argv   form   import   方法   hook   oat   

sys是与Python解释器交互的工具。

先看下dir(sys)

>>> import sys
>>> dir(sys)
[‘__displayhook__‘, ‘__doc__‘, ‘__excepthook__‘, ‘__interactivehook__‘, ‘__loader__‘, ‘__name__‘, ‘__package__‘, ‘__spec__‘, ‘__stderr__‘, ‘__stdin__‘, ‘__stdout__‘, ‘_clear_type_cache‘, ‘_current_frames‘, ‘_debugmallocstats‘, ‘_enablelegacywindowsfsencoding‘, ‘_getframe‘, ‘_git‘, ‘_home‘, ‘_xoptions‘, ‘api_version‘, ‘argv‘, ‘base_exec_prefix‘, ‘base_prefix‘, ‘builtin_module_names‘, ‘byteorder‘, ‘call_tracing‘, ‘callstats‘, ‘copyright‘, ‘displayhook‘, ‘dllhandle‘, ‘dont_write_bytecode‘, ‘exc_info‘, ‘excepthook‘, ‘exec_prefix‘, ‘executable‘, ‘exit‘, ‘flags‘, ‘float_info‘, ‘float_repr_style‘, ‘get_asyncgen_hooks‘, ‘get_coroutine_wrapper‘, ‘getallocatedblocks‘, ‘getcheckinterval‘, ‘getdefaultencoding‘, ‘getfilesystemencodeerrors‘, ‘getfilesystemencoding‘, ‘getprofile‘, ‘getrecursionlimit‘, ‘getrefcount‘, ‘getsizeof‘, ‘getswitchinterval‘, ‘gettrace‘, ‘getwindowsversion‘, ‘hash_info‘, ‘hexversion‘, ‘implementation‘, ‘int_info‘, ‘intern‘, ‘is_finalizing‘, ‘maxsize‘, ‘maxunicode‘, ‘meta_path‘, ‘modules‘, ‘path‘, ‘path_hooks‘, ‘path_importer_cache‘, ‘platform‘, ‘prefix‘, ‘set_asyncgen_hooks‘, ‘set_coroutine_wrapper‘, ‘setcheckinterval‘, ‘setprofile‘, ‘setrecursionlimit‘, ‘setswitchinterval‘, ‘settrace‘, ‘stderr‘, ‘stdin‘, ‘stdout‘, ‘thread_info‘, ‘version‘, ‘version_info‘, ‘warnoptions‘, ‘winver‘]

看下常用的方法:

1、sys.argv 命令行参数

2、sys.exit(n)

3、sys.version

4、sys.maxint

5、sys.path

6、sys.platform

7、sys.stdout.write()

8、sys.

进阶第十二课 Python模块之sys

标签:git   cst   sys.argv   argv   form   import   方法   hook   oat   

原文地址:https://www.cnblogs.com/tuobeiwoniu/p/8682526.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!