import reimport sys text = sys.stdin.read()blocks = re.findall(r'(?sm)^Part 1$(.*?)^Part 0$', text)print(*blocks, sep='\n***\n')
Ненужный текст Part 1 A1 Kh A A4 H6 Part 0 Ненужный текст
A1 Kh A A4 H6
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!