I'm using a FEM software (Code_Aster) which is developed in Python, but its file extension is .comm. However, Python snippets can be inserted in .comm files.
I have a function which returns a very long string containing nodes, elements, elements group, and so on in the below form:

My goal is to add each row to a list/dictionary with its associate coordinates or nodes. For example:
dct_nodes = {
'N5': [
9.99999999998248E-03,
0.00000000000000E+00,
0.00000000000000E+00
]
}
dct_elems = {
'M5': ['N1', 'N5'],
'M85': ['N342', 'N224', 'N378']
}
I tried regex with re.split, re.search, and re.findall but I don't seem to be able to get what I need. This is what I've done so far.
node_list = list()
for item in ttt.split("\n"):
if len(item) != 0: # there are some lines with zero len
if item[0] == 'N':
node_list.append(re.sub("\s+", ",", item.strip()))
The type(node_list[0]) returns string, whereas I would like to have a nested list, so I can grab node_list[0][0] and node_list[0][1] for data manipulation. How can I split this string on , so I can have access to, for examples, the coordinates. I hope anyone can help.