Oct-05-2017, 03:08 PM
you can accomplish the same task using str.split() and the in operator
data = '''clear skin lesions noted mental status, cognition, and cortical functions:m_m_s_e 25/30 · mental status (including orientation to person, place, and time; recent 20/30 blah examination, she was alert and cooperative she scored 29/30 on the m_m_s_e language was fluent pupils were equal and reacted directly and the hour hand where of the same size she scored 25/30 m_m_s_e she had a cautious gait she has mild postural instability ''' for line in data.split('\n'): if 'm_m_s_e' in line: for word in line.split(): if '/' in word: print(word.split('/')[0])
Output:25
29
25
Recommended Tutorials: