#!/usr/bin/env python3 # -*- coding: utf-8 -*- import base64 from curses import echo import re import os BASEPATH = "./line.txt" TOPATH_H = "./out.h" TOPATH_M = "./out.m" def encryptdo(): if os.path.exists(TOPATH_H): os.remove(TOPATH_H) if os.path.exists(TOPATH_M): os.remove(TOPATH_M) f=open(BASEPATH,'r') alllines=f.readlines() f.close() fh=open(TOPATH_H,'w' ,encoding='utf8') # fm=open(TOPATH_M,'w' ,encoding='utf8') for eachline in alllines: repstr = eachline.replace(":",";// ") appstr = "youpaip"+repstr newstr = "@property (copy, nonatomic) NSString* "+appstr f.writelines(newstr) print(newstr) f.close() encryptdo()