-2
我正在尝试将文本中名词中的单词改为“名词”。 我有麻烦。这是我到目前为止。Python中的文件更改
def noun(file):
for word in file:
for ch in word:
if ch[-1:-3] == "ion" or ch[-1:-3] == "ism" or ch[-1:-3] == "ity":
word = "noun"
if file(word-1) == "the" and (file(word+1)=="of" or file(word+1) == "on"
word = "noun"
# words that appear after the
return outfile
任何想法?
“我有麻烦”是不是很描述你的问题。究竟是什么问题? – iCodez 2014-11-20 18:01:20