Advertisement
DiYane

Find variable names in sentence

Sep 27th, 2023
718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.13 KB | None | 0 0
  1. import re
  2.  
  3. some_string = input()
  4. pattern = r'\b_([A-Za-z0-9]+)\b'
  5. matches = re.findall(pattern, some_string)
  6. print(','.join(matches))
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement