1、 创建一个名为test.py的Python脚本文件,文件名可自定义。 2、 在脚本中通过 import os 语句导入 os 模块,具体用法所示。 3、 os.path.dirname(__file__) 用于获取当前脚本文件所在目录的路径。 4、 os.path.join() 可将目录与文件名组合成完整路径,所示。 5、 os.path.split(path) 可将路径拆分为目录和文件名两部 ...
Once you know how to add and use a Python module, you will greatly extend the capabilities of the language. A Python module is an external class or set of functions that exist outside the main file of ...