- """
- python读文本中的第一列内容生成BAT文件.py
- gayhub https://github.com/FGFW/FCNNIC
- 小意思~
- """
- import re
- with open("moban.bat") as f:
- moban=f.read()
- with open("1.txt") as f:
- txt=f.read()
- rec=re.compile("(\\w{7}\\d{5})")
- result=re.findall(rec,txt)
- for r in result:
- moban=re.sub(rec,r,moban)
- with open(r+".bat","w+") as f:
- f.write(moban)
- f.close()
- #该片段来自于http://www.codesnippet.cn/detail/0912201514194.html
来源: http://www.codesnippet.cn/detail/0912201514194.html