ip_addr=[{'IP': '192.16.101.17',
'OS': 'Windows',
'Hostname': 'comp',
'ports': [{'port': '22', 'service': 'ssh'},
{'port': '80', 'service': 'http'}]},
{'IP': '192.16.101.34',
'OS': 'Linux',
'Hostname':'Sahs comp',
'ports':[{'port': '537', 'service': 'ssl'},
{'port': '49547', 'service': 'winrpc'}]}
]
mylist = ip_addr[0]['ports']
print(mylist) --> [{'port': '22', 'service': 'ssh'}, {'port': '80', 'service': 'http'}]
print(ip_addr[0]['ports']) --> [{'port': '22', 'service': 'ssh'}, {'port': '80', 'service': 'http'}]
mylist.remove(mylist[0])
print(ip_addr) --> [{'IP': '192.16.101.17', 'OS': 'Windows', 'Hostname': 'comp', 'ports': [{'port': '80', 'service': 'http'}]}, {'IP': '192.16.101.34', 'OS': 'Linux', 'Hostname': 'Sahs comp', 'ports': [{'port': '537', 'service': 'ssl'}, {'port': '49547', 'service': 'winrpc'}]}]
В какой момент удаляется из ip_addr???
'OS': 'Windows',
'Hostname': 'comp',
'ports': [{'port': '22', 'service': 'ssh'},
{'port': '80', 'service': 'http'}]},
{'IP': '192.16.101.34',
'OS': 'Linux',
'Hostname':'Sahs comp',
'ports':[{'port': '537', 'service': 'ssl'},
{'port': '49547', 'service': 'winrpc'}]}
]
mylist = ip_addr[0]['ports']
print(mylist) --> [{'port': '22', 'service': 'ssh'}, {'port': '80', 'service': 'http'}]
print(ip_addr[0]['ports']) --> [{'port': '22', 'service': 'ssh'}, {'port': '80', 'service': 'http'}]
mylist.remove(mylist[0])
print(ip_addr) --> [{'IP': '192.16.101.17', 'OS': 'Windows', 'Hostname': 'comp', 'ports': [{'port': '80', 'service': 'http'}]}, {'IP': '192.16.101.34', 'OS': 'Linux', 'Hostname': 'Sahs comp', 'ports': [{'port': '537', 'service': 'ssl'}, {'port': '49547', 'service': 'winrpc'}]}]
В какой момент удаляется из ip_addr???