python中os和sys模块的区别与常用方法总结
os与sys模块的官方解释如下: os: This module provides a portable way of using operating system dependent functionality. 这个模块提供了一种方便的使用操作系统函数的方法。 sys: This module provides ess to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. 这个模块可供访问由解释器使用或维护的变量和与解释器进行交互的函数。 总结就是,os模块负责程序与操作系统的交互,提供了访问操作系统底层的接口;sys模块负责程序与python解释器的交互,提供了一系列的函数和变量,用于操控python的运行时环境。
声明:
该资讯来自于互联网网友发布,如有侵犯您的权益请联系我们。