当前位置:编程学习 > 网站相关 >>

python之pptv去广告代码讲解

#! /usr/local/env python
#-*- coding=utf-8 -*-
import os
import stat

fileConfigList = (
r"PPLivePPTVxmlframegallop.xml",
r"PPLivePPTVxmlplayctrlgallop.xml",
r"PPLivePPTVcachepluginadAdList6.Xml",
r"PPLivePPTVcachepluginadAdConfig.ini"
)

for file in fileConfigList:
#所有用户的PROFILE路径
if not os.path.exists(os.getenv(APPDATA) file):
file = os.getenv(ALLUSERSPROFILE) "\Application Data" file
else:
#当前用户的应用程序路径
file = os.getenv(APPDATA) file
#修改为可写属性
os.chmod(file, stat.S_IWRITE)
#清空文件
open(file,"w").write("")
#修改为只读属性,pplive将不再能写入广告
os.chmod(file, stat.S_IREAD)
补充:Web开发 , Python ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,