Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- file_path = "demodata.txt"
- with open(file_path, 'r') as file:
- content = file.read()
- hashtags = re.findall(r"#\w+", content)
- print("Extracted Hashtags:", hashtags)
- demodata.txt
- Learning about #Python is so much fun!
- #MachineLearning and #DataScience are the future.
- Can't wait to explore more about #Artificial_Intelligence and #Deep_Learning!
- #Coding is truly amazing.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement