iOS 利用脚本对项目的设置

2018-11-20  本文已影响11人  逆光少年

一.修改类名前缀

#!/usr/bin/env python
import os
for dirpath, _, filenames in os.walk('.'):
    for filename in filenames:
        if filename.startswith('SC'):
            oldFile = os.path.join(dirpath, filename)
            newFile = os.path.join(dirpath, filename.replace('SC', 'SD', 2))
            print newFile
            inFile = open(oldFile)
            outFile = open(newFile, 'w')
            replacements = {'SC':'SD'}
            for line in inFile:
                for src, target in replacements.iteritems():
                    line = line.replace(src, target)
                outFile.write(line)
            inFile.close()
            outFile.close()
            os.remove(oldFile)

filename.replace是把SC替换成SD

参考:https://blog.csdn.net/qq_23292307/article/details/80915654

上一篇下一篇

猜你喜欢

热点阅读