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

Python中sys和os模块的区别

时间:2018-05-03 23:28:00      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:use   main   ESS   操作   lis   this   fun   not   over   

  1. sys: This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available. 参见:https://docs.python.org/3/library/sys.html
  2. os:This module provides a portable way of using operating system dependent functionality. If you just want to read or write a file see open(), if you want to manipulate paths, see the os.path module, and if you want to read all the lines in all the files on the command line see the fileinput module. For creating temporary files and directories see the tempfile module, and for high-level file and directory handling see the shutil module. 参见:https://docs.python.org/3/library/os.html

通俗地来说:

  1. sys用于利用Python编译器的一些变量或函数来完成任务。
  2. os用于利用操作系统的一些变量和函数(大多经过了重新命名以提高可移植性)来达到目的。

Python中sys和os模块的区别

标签:use   main   ESS   操作   lis   this   fun   not   over   

原文地址:https://www.cnblogs.com/lyg-blog/p/8988001.html

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