Input data =
"Port Native VLAN Trunk VLANs
\r\n-------------------------------------------------------------------------\r\n1/1/2 1 1-2,77,90,802,998-999\r\n1/1/4
2 2,10,12-15,25,30,44,555,802\r\n1/1/5 None 10,555\r\n1/1/6 2 2,10,12-15,25-26,30,44,77,80,90,150,190,260,555,\r\n
767,802,997-999,1379\r\n1/1/7 None 10,555\r\n1/1/8 2 2,10,12-15,25,30,44,555,802\r\n1/1/9 2 2,10,12-15,25-26,30,44,77,80,90,150,190,260,555,\r\n 767,802,997-999,1379\r\n"
I have input data that look like this and want to convert this to a Python dictionary with keys as headers of table and values as the column data
Expected Output:
[{'Port': '1/1/2', 'Native VLAN': '1', 'Trunk VLANs': '1-2,77,90,802,998-999'}, {'Port': '1/1/4', 'Native VLAN': '2', 'Trunk VLANs': '2,10,12-15,25,30,44,555,802'}, {'Port': '1/1/5', 'Native VLAN': 'None', 'Trunk VLANs': '10,555'}, {'Port': '1/1/6', 'Native VLAN': '2', 'Trunk VLANs': '2,10,12-15,25-26,30,44,77,80,90,150,190,260,555,767,802,997-999,1379'}]