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