Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
15,529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. import re
  2.  
  3. parts = ["@gmail", "@cngmail.", "google", "hotmail"]
  4.  
  5. test = "name@gmail.com, "
  6. test2 = test.replace(" ","").replace(",","")
  7. #cut-off comma and whitespaces at the end
  8.  
  9. print(test2) # name@gmail.com
  10. print(parts[0]) # @gmail
  11.  
  12. print(parts[0] in test2)
  13. print(re.search(parts[0], test2))
  14. print(test2.rfind(parts[0]))
  15.  
  16. name@gmail.com
  17. @gmail
  18.  
  19. False
  20. None
  21. -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement