2021
08-11
08-11
Python基础之内置模块详解
目录一、os二、shutil三、sys四、random五、hashlib六、configparser七、xml八、json九、time十、datetime一、osimportos#1.获取当前脚本绝对路径"""abs_path=os.path.abspath(__file__)print(abs_path)"""#2.获取当前文件的上级目录"""base_path=os.path.dirname(os.path.dirname(路径))print(base_path)"""#3.路径拼接"""p1=os.path.join(base_path,'xx')print(p1)p2=os.path.join(base_path,'xx','oo',...
继续阅读 >