How to split a string with two spaces in Python?

the longest string length is 7 and the shortest string length is 3.
when using the split () function, you cannot handle things such as: "oops, that is, the string may have two spaces, and you want to use the second space as the delimiter. What can you do when you use the split () function to get the result of" oops.
instead of the desired "oops."?

Update:
most of the strings are as follows (each line represents a string):
9 O
at O
Line O
"O
stomach B-SUR
Cancer I-SUR
Root I-SUR
, you can get ["9jue"], ["Yu", O"], ["I","O"]
but encounter this kind of string and get ["O"]. [","O"]
w = ["9djingho"], there is a reference to w [1], if w = [" O"], the reference to w [1] will report an error.

Mar.25,2021

the logical description is not clear. I don't think split can be implemented.

1234567
a+b+c+d = > ["a", "b", "c", "d"]
aPPbcde = > ["a", "+ bcde"]
aPPbcd = > ["a", "+ bcd" or "PPbcd"]-sharp2+ consecutive spaces how to handle
+ abcdef = > ["abcdef" or "+ abcdef"]-sharp first character spaces?

update:
you can try:

>>> "a  b  c".split(" ")
['a', '', 'b', '', 'c']
>>>" O".split(" ")
['', 'O']
The space between two spaces is also treated as an element. It feels too metaphysical, and it's still different from what you actually want.


does the landlord mean that a single string is "O" instead of "you O"? But "O" does not satisfy the minimum 3 characters you said at the beginning, wow
, or you say "you O". Do you want to get ['you','O']?

Menu