Guest User

Untitled

a guest
Nov 22nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import re
  2.  
  3. s = "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."
  4.  
  5. """
  6. re.sub(pattern, repl, string, count=0, flags=0)
  7. """
  8. s = re.sub(r'[,.]', '', s)
  9.  
  10. s_list = s.split()
  11.  
  12. answer = []
  13.  
  14. #文字数をカウントし出現順に配列に格納してるとこ
  15. for n in s_list:
  16. answer.append(len(n))
  17.  
  18. print(answer)
Add Comment
Please, Sign In to add comment