文件、文件夹是否存便宜香港vps在if (not os.path.exists(file)): print(“file not exists”) 是否能访问os.access(path, mode)mode:os.F_OK: 检查文件是否存在os.R_OK: 检查文件是否可读os.W_OK: 检查文件是否可以写入os.X_OK: 检查文件是否可以执行 opentry: f = open(file_path, “wb”) f.close()except FileNotFoundError: print “File is not found.”except PersmissionError: print “You don’t have permission to access this file.”
?
29587513