I have a string:
my_string = "'T1', 'T2', 'T3', 'T4', True, False"
I would like to convert to a list like this
my_list = ['T1', 'T2', 'T3', True, False]
I've tried to do my_string.split(', ')
but it converts the True
and False
into str
, which I don't want.
I could write a function but I feel there is something pythonic and very easy to do this.
What would be the best way to do it ?