温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何找到python的sys模块位置

发布时间:2020-07-18 12:00:05 阅读:520 作者:清晨 栏目:编程语言
Python开发者专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

小编给大家分享一下如何找到python的sys模块位置,相信大部分人都还不怎么了解,因此分享这边文章给大家学习,希望大家阅读完这篇文章后大所收获,下面让我们一起去学习方法吧!

当前使用的python版本: Python 2.7.6

sys是python自带模块.

利用 import 语句输入sys 模块。

当执行import sys后, python在 sys.path 变量中所列目录中寻找 sys 模块文件。然后运行这个模块的主块中的语句进行初始化,然后就

可以使用模块了 。

sys模块常见函数

可以通过dir()方法查看模块中可用的方法. 结果如下, 很多我都没有用过, 所以只是简单介绍几个自己用过的方法.

$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help""copyright""credits" or "license" for more information.
>>> import sys
>>> dir(sys)
['__displayhook__''__doc__''__excepthook__''__name__''__package__''__stderr__''__stdin__''
__stdout__',
 '_clear_type_cache''_current_frames''_getframe''_mercurial''_multiarch''api_version''argv', 
 'builtin_module_names''byteorder''call_tracing''callstats''copyright''displayhook', 
 'dont_write_bytecode', 
 'exc_clear''exc_info''exc_type''excepthook''exec_prefix''executable''exit''flags''float_info',
  'float_repr_style''getcheckinterval''getdefaultencoding''getdlopenflags''getfilesystemencoding', 
  'getprofile''getrecursionlimit''getrefcount''getsizeof''gettrace''hexversion''long_info', 
  'maxint', 
  'maxsize''maxunicode''meta_path''modules''path''path_hooks''path_importer_cache''platform',
   'prefix',
   'ps1''ps2''py3kwarning''pydebug''setcheckinterval''setdlopenflags''setprofile', 
   'setrecursionlimit', 
   'settrace''stderr''stdin''stdout''subversion''version''version_info''warnoptions']

以上是如何找到python的sys模块位置的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×