from nltk.corpus import stopwords
print "starting to read \n"
fw=open('cde.txt','w');
with open('test.txt') as fp:
for line in fp:
fw.write('\n')
fw.write(line)
fp.close()
fw.close()
print "\ndone with writing \n"
print "starting to print from another file \n"
with open('cde.txt','r+') as ss:
for line in ss:
for word in line.split():
if word in stopwords.words('english'):
#ss.write(line.remove(word))
ss.remove(word)
#print line.rstrip()
ss.close()
#for word in line.split():
print "done with printing from another file"
'kaldır' amaAttributeError: 'dosya' nesne bu senaryoyu çalıştırıyorum
AttributeError: 'file' object has no attribute 'remove'
hata almaya devam hiçbir özelliği vardır.
Gerçekten neye ulaşmak istiyorsunuz? –
[İlgili] (http://stackoverflow.com/questions/21005921/deleting-a-specific-word-from-a-file-in-python) – Idos
i bir dosyadan gerçekte nedir – sk79