📜  python删除只读文件 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:20.928000             🧑  作者: Mango

代码示例1
import os
    import stat
    def rmv_rof(file_name):
        '''Remov Read Only Files'''
        if os.path.exists(file_name):
            os.chmod(file_name, stat.S_IWRITE)
            os.remove(file_name)
        else:
            print('The file does not exist.')
    rmv_rof('file_name_here')