1. 程式人生 > >Python指令碼實現去除檔案的只讀性

Python指令碼實現去除檔案的只讀性

 如何在PYTHON中移去檔案的只讀屬性, 用chmod命令stat.S_IWRITE

import os
import stat
os.chmod( filename, stat.S_IWRITE )

如去除檔案

D:\整合架\MobileDgnSdk12\samples\PKPM-Scaffolding\PBimAllProducts\Debug\PKPMECSchemas\Base\PBM_ConstructModel.01.00.ecschema.xml的只讀性
import os
import stat
os.chmod( "D:\整合架\MobileDgnSdk12\samples\PKPM-Scaffolding\PBimAllProducts\Debug\PKPMECSchemas\Base\PBM_ConstructModel.01.00.ecschema.xml", stat.S_IWRITE )