Advertisement
GamerBhai02

Assignment 2

Mar 20th, 2025
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | Source Code | 0 0
  1. import re
  2. file_path = "demodata.txt"
  3. with open(file_path, 'r') as file:
  4.     content = file.read()
  5. hashtags = re.findall(r"#\w+", content)
  6. print("Extracted Hashtags:", hashtags)
  7.  
  8. demodata.txt
  9. Learning about #Python is so much fun!
  10. #MachineLearning and #DataScience are the future.
  11. Can't wait to explore more about #Artificial_Intelligence and #Deep_Learning!
  12. #Coding is truly amazing.
Tags: Ass 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement