I am trying to convert string representation of list containing namedtuples into normal list.
Tried eval_literal, json.loads and split.
Error with ast.literal_eval
ValueError: malformed node or string: <_ast.Call object at 0x7f834bef5860>
After adding double quotes to string
SyntaxError: invalid syntax
Error with json.loads()
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
Problem with split is it is converting data types of contents of the namedtuple.
Please suggest me possible solution. input :
'[milestone(id=1, amount=1000, curency='inr'), milestone(id=1, amount=1000, curency='inr')]'
type<str>
expected output:
[milestone(id=1, amount=1000, curency='inr'), milestone(id=1, amount=1000, curency='inr')]
type<list>