10. 标准库简介

10.1. 操作系统接口

The os module provides dozens of functions for interacting with the operating system:

>>> import os
>>> os.getcwd()      # Return the current working directory
'C:\\Python313'
>>> os.chdir('/server/accesslogs')   # Change current working directory
>>> os.system('mkdir today')   # Run the command mkdir in the system shell
0