I
I
i_ikigai2020-06-28 01:14:31
Python
i_ikigai, 2020-06-28 01:14:31

What regular expression is needed to take the line to the end after the first few words?

Is there such a text, how to take this line to the end after a digit or tsirf, a dot and the beginning of a word? 26. It
's a Wonderful Life (1946 ) you can write for a long time. Once again the director...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-06-28
@i_ikigai

import re
txt = '''
26. Эта замечательная жизнь (It’s a Wonderful Life) (1946)
Мысли о самоубийстве одолевают в определенные периоды жизни любого че...

27. Однажды на Диком Западе (C’era una volta il West) (1968)
Об этом вестерне Серджио Леоне можно писать долго. Режиссер в очередной раз
'''
m = re.findall(r'(?m)^\d+\.\s*(.*)', txt)

print(m)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question