I have a returned string from a function such:
"& True True & True False & False"
I need to write a function that puts all the elements between & in a list and deletes it, such:
[[True, True], [True, False], [False]]
How do I do it? thanks in advance!
results = mystring.split("&")would be a good start.split()to split it at whitespace. Then loop over those strings and replace"True"withTrueand"False"withFalse[list(map(lambda s: s=='True', entry.split())) for entry in value.split('&') if entry]