Python extracts the text after the first colon (or other punctuation marks) in a sentence

Problem: Need to extract all the text after "Past History:":

If using:

.split(':’)

Divide this sentence into three parts with two semicolons.

So use:

.split(':', 1)

"1" is the number of splits, the default is -1, that is, split all, set it to 1 here, you can divide this sentence into 1+1=2 parts,

i.e. get:

Past history:

General health status: The patient was previously in good health.

Guess you like

Origin blog.csdn.net/m0_52583356/article/details/115984353