Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- parts = ["@gmail", "@cngmail.", "google", "hotmail"]
- test = "name@gmail.com, "
- test2 = test.replace(" ","").replace(",","")
- #cut-off comma and whitespaces at the end
- print(test2) # name@gmail.com
- print(parts[0]) # @gmail
- print(parts[0] in test2)
- print(re.search(parts[0], test2))
- print(test2.rfind(parts[0]))
- name@gmail.com
- @gmail
- False
- None
- -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement