zoukankan      html  css  js  c++  java
  • python自动化工具

    公司有些业务不断的重复复制和黏贴实在让人头疼,于是乎考虑使用python自动的生成文件,并且替换文件中的一些内容,把需要复制和黏贴的内容制作成

    模版,以后的开发工作可以根据模版来自动生成文件,自己以后就不用那么麻烦的复制和黏贴的重复制造轮子了。同时也让自己慢慢的熟悉和使用python!

    
     #coding:utf-8
    import os,sys,re
    project_dir = "d:/project/aushop/application/views/show/ringsign"
    php_dir ="d:/project/aushop/application/library/Active/RingSign"
    def (infile,name):
    if os.path.isfile(project_dir+name+".phtml 大专栏  python自动化工具4;):
    print u'文件已经存在'
    sys.exit(1)
    if not os.path.isfile(infile):
    print u'文件不存在'
    sys.exit(1)
    try:
    infile = open(infile, "r")
    outfile = open(project_dir+name+".phtml", "wb")
    except IOError:
    print "The file don't exist, Please double check!"
    exit()
    all_the_lines = infile.readlines()
    infile.seek(0)
    for line in all_the_lines:
    
  • 相关阅读:
    [Leetcode]@python 76. Minimum Window Substring
    [Leetcode]@python 75. Sort Colors
    HTNL表单
    第二天
    开学心德
    HTML表单
    网页制作
    2nd day
    开课心得
    CF10D/POJ2127 LCIS 题解
  • 原文地址:https://www.cnblogs.com/lijianming180/p/12346116.html
Copyright © 2011-2022 走看看