I have file formatted like this:
MN_N3 net48 sout VSS VBN lvtnfet l=0.116u nf=1 M=1 nfin=4
MN_N10 net082 net48 VSS VBN lvtnfet l=0.116u nf=1 M=1 nfin=4
MN_N11 nclk_net CK VSS VBN lvtnfet l=0.068u nf=1 M=1 nfin=4
MN_N9 SO SE net082 VBN lvtnfet l=0.116u nf=1 M=1 nfin=4
I want to read it as list of dictionaries such that each line forms a dictionary like this
{'name': 'MN_N3' , 'source': 'net48' , 'gate': 'sout', 'Drain':'VSS'}
I have tried this:
d{'name':line.split(' ')[0], 'source':line.split(' ')[1], 'gate':line.split(' ')[2], 'drain':line.split(' ')[3]}
Which gave me:
File "task2.py", line 24
d{'name':line.split(' ')[0], 'source':line.split(' ')[1], 'gate':line.split(' ')[2], 'drain':line.split(' ')[3]}
^
SyntaxError: invalid syntax
How can I do this / fix this error?