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转换代码格式-创新互联
网页地址:http://www.tyjierui.cn/article/dphhoj.html
其他资讯
- load-on-startup在servlet中的作用有哪些-创新互联
- PHP中抽象工厂模式指的是什么
- Jenkins持续集成——参数化构建
- python中return语句怎么用
- 基于VSFTP的本地YUM源及光盘YUM源搭建步骤是怎样的
- 包含Windows的系统变量的词条
- cannot find ../../../../../external/micro-ecc/nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a: No such file or directory 问题
- android发展史 android的发展历程和系统架构
- MySQL内置函数中的日期和时间函数详解
- 域控制器的安装与配置?如何创建子域的dns服务器


咨询
建站咨询
在独山子等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站制作、