import os # 获取当前路径 doing_path = os.getcwd() print(doing_path) # 重命名 # os.rename(r'/Users/yy/Desktop/file.txt', r'/Users/yy/Desktop/file111.txt') # 路径拼接 file_path = os.path.join(doing_path, 'file111.txt') print(file_path) # 获取文件权限 os.access(path, mode) # F_OK(是否存在),R_OK(可读),W_OK(可写),X_OK(可执行) print(os.access(file_path, os.F_OK)) print(os.access(file_path, os.R_OK)) print(os.access(file_path, os.W_OK)) print(os.access(file_path, os.X_OK)) # 更改文件权限 os.chmod