K
kylin
I need to remove the word if it appears in the paragraph twice. could
some give me some clue or some useful function in the python.
some give me some clue or some useful function in the python.
I need to remove the word if it appears in the paragraph twice. could
some give me some clue or some useful function in the python.
kylin said:I want to remove all the punctuation and no need words form a string
datasets for experiment.
twice. couldI need to remove the word if it appears in the paragraph twice. could
some give me some clue or some useful function in the python.
kylin said:I need to remove the word if it appears in the paragraph twice. could
some give me some clue or some useful function in the python.
p=re.compile(r'(.+) .*\1') #note the space
s=p.search("python and i love python")
s.groups()
(' python',)
But that matches for only one double word.Someone else could light up here
to extract all the double words.Then they can be removed from the original
paragraph.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.