I want to split a string like:
strg = "22+11-aa+bb-44-"
into a list like this:
my_list = ['22', '+','11', '-', 'aa', '+', 'bb', '-44', '-']
All the non-digit elements are totally split out, if the element after ‘-‘ is made of digits, then it should join together with the ‘-‘ and become a negative number.
A solution without regexs that makes it longer, but faster on the large data sets:
result: