python转换代码格式-创新互联

在独山子等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站制作、做网站 网站设计制作定制网站开发,公司网站建设,企业网站建设,成都品牌网站建设,全网营销推广,外贸网站建设,独山子网站建设费用合理。>import os dirname="C:\Users\haier\Desktop\new"def walk(path): for item in os.listdir(path): subpath= os.path.join(path, item) #subpath=subpath.replace('\','\\') print subpath for i in open(subpath): pass#print i ffrom=open(subpath,'r') fto=open(subpath+"1",'w') while True: l=ffrom.readline() if not l: break if 'endif' in l: print l l=l.replace('endif','end') print l elif 'endwhile' in l: print l l=l.replace('endwhile','end') print l # if '"' in l: # print l # l=l.replace('"',''') # print l # print l # tmp=l.split(""") #l=tmp[0]+"'"+tmp[1] fto.write(l) ffrom.close() fto.close() def dele(path): for item in os.listdir(path): subpath= os.path.join(path, item) # subpath=subpath.replace('\','\\') if os.path.exists(subpath+"1"): ffrom=open(subpath+"1",'r') fto=open(subpath,'w') while True: l=ffrom.readline() if not l: break fto.write(l) ffrom.close() fto.close() os.remove(subpath+"1") walk(dirname) dele(dirname)
分享名称:python转换代码格式-创新互联
链接URL:http://csruizhi.cn/article/dphhoj.html

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 手机网站制作 H5网站制作 重庆网站制作 网站建设推广 网站设计 成都网站设计制作公司 高端网站设计 成都网站设计 营销型网站建设 成都网站建设 成都网站建设公司 网站建设开发 专业网站设计 成都网站建设 成都网站建设 网站制作 网站制作报价 重庆外贸网站建设 网站建设 成都定制网站建设 高端网站设计 成都企业网站建设公司