Advertisement
aneliabogeva

Split by Word Casing

Jun 18th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import re
  2.  
  3. words = [str(item) for item in re.split("[,;:.!()\"\'\\\\/\[\] ]+", input())if item != ""]
  4. lower_case = []
  5. upper_case = []
  6. mixed_case = []
  7.  
  8. for word in words:
  9. if re.compile("^[a-z]+$").match(word):
  10. lower_case.append(word)
  11. elif re.compile("^[A-Z]+$").match(word):
  12. upper_case.append(word)
  13. else:
  14. mixed_case.append(word)
  15.  
  16. print("Lower-case: ", end="")
  17. print(", ".join(lower_case))
  18. print("Mixed-case: ", end="")
  19. print(", ".join(mixed_case))
  20. print("Upper-case: ", end="")
  21. print(", ".join(upper_case))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement