os.getcwd():
函数os.getcwd()返回用于执行代码的文件的当前工作目录(CWD)
import os
print(os.getcwd())
# To print absolute path on your system
# os.path.abspath('.')
# To print files and directories in the current directory
# on your system
# os.listdir('.')产出:
C:\Users\GFG\Desktop\ModuleOS
注意:对于GFG解释器,使用的目录是\root。