May-11-2022, 02:06 PM
(May-11-2022, 01:56 PM)menator01 Wrote: if/else inside the for loop
def ip_check(): hosts = [ "192.168.180.100", "192.168.180.101", "192.168.180.102", "192.168.180.103", "192.168.180.104", "192.168.180.105", "192.168.180.106" ] for x in hosts: host_response = os.system("ping -c 1 " + str(hosts)) if host_response == 0: print('command 1') else: print('command 2')
I copied your code 1:1 but I still get the message that the name or service (106) is not known...