У меня есть этот текст:
DIAGNOSIS
M19.072 Primary osteoarthritis, left ankle and foot 1
M19.072 Primary osteoarthritis, left ankle and foot 2
O RTHOSIS DEVICE(S) PRESCRIBED
gfgfgfggfgfg
111111111112ffffffffff
gfggggg
DIAGNOSIS
M17.12 Unilateral primary osteoarthritis, left knee
O RTHOSIS DEVICE(S) PRESCRIBED
gfgfgfggfgfg
11111ttttfffff
gffffffffffffffffffffffffwwwwwwwwwree
DIAGNOSIS
M75.42 Impingement syndrome of left shoulder
O RTHOSIS DEVICE(S) PRESCRIBED
gfgfgfggfgfg
111111111112ffffffffff
gfggggg
wwwwwwwwww
, и я хочу получить только эти три строки !!!!
M19.072 Primary osteoarthritis, left ankle and foot 1
M19.072 Primary osteoarthritis, left ankle and foot 2
M17.12 Unilateral primary osteoarthritis, left knee
M75.42 Impingement syndrome of left shoulder
это мой код python, но иногда он не работал !
diagnosis_Answer = re.findall(r"(DIAGNOSIS(\s.*?)+RTHOSIS DEVICE)+", txt)