I cannot seem to figure this out. This part of a larger script that I am writing. I have a list that looks like this. The fields are servername, port and program. How do I sort it to get a tally of what servers are listening on what ports.
This is my list:
[,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
]
This is what I want:
1045 is open on server1, server4
8001 is open on server1
2226 is open on server3, server6
etc...
So far this is what I have but it doen't quite work:
allports = list(set(total.keys()))
lines = total.values()
for port in allports:
for line in lines:
if line[1] == port:
data[port] = line[0]