Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import re
  2. clean_title = re.match(r'(.*)(.*)', title.lower())
  3. if clean_title:
  4. return clean_title.group(1).rstrip()
  5.  
  6. >>'Alone in the Dark (The Cincinnati Series Book 2)'
  7. >>'alone in the dark'
  8.  
  9. >>> clean_title = 'Alone in the Dark (The Cincinnati Series Book 2)'
  10. >>> clean_title.split('(', 1)[0].lower().rstrip()
  11. 'alone in the dark'
  12.  
  13. >>> clean_title = 'Test'
  14. >>> clean_title.split('(', 1)[0].lower().rstrip()
  15. 'test'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement