fork(3) download
  1. import re
  2. contents =r"""7.2.P.8.1
  3.  
  4. Summary and Conclusion
  5.  
  6.  
  7. A stability study with two batches was carried out.
  8.  
  9. 7.2.P.8.2
  10.  
  11. Another summary and Conclusion
  12.  
  13.  
  14. A stability study with two batches was carried out."""
  15.  
  16. rx = re.compile(r'\d+(?:[.-]\w+)*\s*(\S.*)?$')
  17. found = False
  18. for line in contents.splitlines():
  19. if not found:
  20. m = rx.match(line)
  21. if m:
  22. if m.group(1):
  23. print(m.group(1))
  24. break
  25. else:
  26. found=True
  27. else:
  28. if not line.strip():
  29. pass
  30. else:
  31. print(line.strip())
  32. break
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
Summary and Conclusion