Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. mystr = r'''documentclass[12pt]{article}
  2. usepackage{amsmath}
  3. title{LaTeX}
  4. begin{document}
  5. section{Introduction}
  6. This is introduction paragraph
  7. section{Non-Introduction}
  8. This is non-introduction paragraph
  9. section{Sample section}
  10. This is sample section paragraph
  11. end{document}'''
  12.  
  13. ['This is introduction paragraph','This is non-introduction paragraph',' This is sample section paragraph']
  14.  
  15. my_string = "a quick brown fox jumps over a lazy dog than a quick elephant"
  16. word = "a "
  17. my_string.split(word)
  18.  
  19. ['', 'quick brown fox jumps over ', 'lazy dog than ', 'quick elephant']
  20.  
  21. import re
  22. str_ = "a quick brown fox jumps over a lazy dog than a quick elephant"
  23.  
  24.  
  25. print(re.split(r's?babs?',str_))
  26.  
  27. # ['', 'quick brown fox jumps over', 'lazy dog than', 'quick elephant']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement