'Read data from text file given in a Tree format

I am trying to read the data from a text file given in a tree format.

A sample of the text file looks like this,

['972651', '80080680482123777', '0.0']->['10678072', '80080680482123777', '1.8']
['972651', '80080680482123777', '0.0']->['14569462', '80080680482123777', '1.8']
['972651', '80080680482123777', '0.0']->['41634505', '80080680482123777', '1.8']
['972651', '80080680482123777', '0.0']->['81232966', '80080680482123777', '1.8']
['972651', '80080680482123777', '0.0']->['21282483', '80080680482123777', '1.8']
['972651', '80080680482123777', '0.0']->['35165557', '80080680482123777', '1.8']
['972651', '80080680482123777', '0.0']->['12735762', '80080680482123777', '1.8']
['972651', '80080680482123777', '0.0']->['39076620', '80080680482123777', '1.8']

In the tree file, each line represents an edge given in the following format:
** parent node -> child node
** Each node is given as a tuple: ['uid', 'tweet ID', 'time delay']

I am not sure how shall I read this data. Can someone please help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source