Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- word='Lorem Ipsum'
- findword=re.compile(f'{word}')
- with open('mytext.txt','r') as file:
- data=file.read()
- wl=findword.search(data)
- l=wl.group()
- print('{} has been founded {} times'.format(word,data.count(l)))
Add Comment
Please, Sign In to add comment