I'm trying to parse a string read from a txt file. The line is :
(0 ,3) :5.0|(1 ,3) : -5.0
I need to firstly get (0,3) then 5, after splitting with "|" I need to get (1,3) and -5
At the end, I should have 2 list variable that holds the values seperately. The first list should have : (0,3) and (1,3) The second list should hold : 5,-5
What I tried:
goal_states, their_reward = lines[5].split("|"), lines[5].rsplit(':', 1)
What I get : ['(0,3):5.0|(1,3)', '-5.0']
Thank you in advance
P.S: I shouldn't use any import statement.