I have a long Python string of the form:
string='Black<5,4>, Black<9,4>'
How can I split this string, and any other of arbitrary length which has the same form (i.e. <ArbitraryString1<ArbitraryListOfIntegers1>,<ArbitraryString2<ArbitraryListOfIntegers2>,...) into a list of tuples.
For example, the following would be the desired output from string:
list_of_tuples=[('Black',[5,4]),'Black,[9,4])
Usually I'd use string.split on the commas to produce a list and then regex to separate the word from the <> but since I need to use commas to delimit my indices (the contents of the <>), this doesn't work.