I have txt files in russian which i need to read and trim out all the special characters like !,digits, blankspaces and write it into another file in the encoded form.
Below is the code i am using for
for fname in filelist:
count = 0
path = os.path.join(dirs, fname)
txtfile = file('%s/%s.txt' % (dir, fname), 'w', 'utf-8')
textf = codecs.open("%s/%s" % (dirss,fname), 'r', "utf-8")
p = re.compile("[^a-z A-Z]")
lines = textf.readlines()
for line in lines:
s2 = p.sub("", line)
if count <= count1:
if count == count1:
When i execute the above code it gives me an error TypeError: an integer is required
I am working with multiple lanaguges of txt files.