Dec-17-2019, 04:50 PM
(Dec-17-2019, 04:09 PM)ichabod801 Wrote: The csv module has a DictReader class that converts the data into a dictionary. If that is not giving you the dictionary you want, perhaps you could show us a few rows of the data you have, and how you would want those rows to look when converted to a dictionary.
Thank you for the reply.
Here is an example of the output of the *.csv I am looking at.
IP_Address,NodeName,DeviceRole,sha1(DeviceRole)
xxx.xxx.xxx.xxx,sxxxr1,Branch Router,181B2DF9E3B6FF829F94FFD142ED9F965684F40B
xxx.xxx.xxx.xxx,sxxxsw1,Layer 3 Remote Switch,AD8CDCABA055C5FA52B4C2F39CD32E927B20B185
xxx.xxx.xxx.xxx,sxxxsw2,Layer 2 Remote Switch,4FA0DF65ACAB35ADCF923AF1E0164D12149A63DC
So I want to have a dictionary with key values for IP Address and Node Name. Those values are in row 1 of the *.csv file. I want every value under those put in a dictionary so that I can iterate through the dictionary and connect to the devices IP address/hostname.
I hope that makes sense.