import codecs
import string
outputfile_human = "C:\Users\we\Desktop\mytest.txt"
fout=codecs.open(outputfile_human,'w','UTF8')
inputfile_name = r"C:\Users\we\Desktop\sms_result_checked.txt"
def replaceStr(str,re):
for chr in re:
str = string.replace(str.upper(),chr,'',)
return str
if __name__ == '__main__':
sf = open(inputfile_name)
lines = sf.readlines()
f = open(outputfile_human,'w')
for line in lines:
t = ''.join(line.split())
test = ['/NW','[',']','/PER','/LOC','/ORG']
tt = replaceStr(t,test)
f.write(tt+'\n')