So basically the goal of this code is to report which ports on a group of devices are being utilized.
The code is as follows:
$
file_name = input('Enter File Name: ') + str('.csv') total_ports = 500
my_reader = csv.reader(open(file_name)) ctr = 0 for total_reserved in my_reader: if total_reserved[2] == 'Reserved': ctr += 1 print(ctr, 'out of ', total_ports, 'PLS ports are reserved')
my_reader = csv.reader(open(file_name)) ctr_pls0 = 0 for pls0 in my_reader: if pls0[0] == 'L1 switches/L1 Switch 10G PLS0.BLLAB/Blade01' and total_reserved[2] == 'Reserved': ctr_pls0 += 1
print(ctr_pls0, 'of these', ctr, 'are pls0 ports') $
This gives me the following output...
Enter File Name: 31.05.2018 175 out of 500 PLS ports are reserved 0 of these 175 are pls0 ports
Process finished with exit code 0
0 of these 175 are pls0 ports this is where the issue lies, this line should be providing me with the amount of ports that are called 'L1 switches/L1 Switch 10G PLS.BLLAB/Blade01' AND that are shown as 'Reserved' as per the .csv file.
Any ideas of what this could be?
Thanks!
J
Aucun commentaire:
Enregistrer un commentaire