In Python, I am trying to split a string until an occurence of an integer, the first occurence of integer will be included, rest will not.
Example strings that I will have are shown below:
SOME STRING (IT WILL ALWAYS END WITH PARANTHESIS) 2 3 ---
SOME OTHER STRING (PARANTHESIS AGAIN) 5 --- 3
AND SOME OTHER (AGAIN) 2 1 4
And the outputs that I need for these examples are going to be:
SOME STRING (IT WILL ALWAYS END WITH PARANTHESIS) 2
SOME OTHER STRING (PARANTHESIS AGAIN) 5
AND SOME OTHER (AGAIN) 2
Structure of all input strings will be in this format. Any help will be appreciated. Thank you in advance.
I've basically tried to split it with using spaces (" "), but it of course did not work. Then, I tried to split it with using "---" occurence, but "---" may not exist in every input, so I failed again. I also referred to this: How to split a string into a string and an integer? However, the answer suggests to split it using spaces, so it didn't help me.