Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- sent = 'a b c b c c A B C B C C'
- match = re.search('\w+', sent)
- while match:
- word = match.group()
- sent, count = re.subn(word, '', sent, flags=re.I)
- match = re.search('\w+', sent)
- print(word, count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement