I keep getting IndexError: list index out of range but I know where the problem is in the json I am mapping.
server_names_and_ips = [
(x['virtualMachine']['name'], x['virtualMachine']['network']['publicIpAddresses'][0]['ipAddress']) for x in
s if x['virtualMachine']['network']['publicIpAddresses'][0]['ipAddress'] is not None]
The problem is x['virtualMachine']['network']['publicIpAddresses'][0]['ipAddress'] has a value you [] in one of the items returned. I tried to put the if condition in for it but that didnt work correctly. Is something wrong with how I wrote the if condition? The desired outcome who be...if it has [] dont add that item to list and move onto the next.