while true цикл

Подскажите пожалуйста, как мне создать условие

    with open('ip.txt', 'r') as f:
        ips = f.readlines()



if __name__ == "__main__":
    threading()
    root.mainloop()

Ответы (1 шт):

Автор решения: Сергей Шашко
ind = 0
for index, ip in enumerate(ips):
    response = subprocess.call(['ping', '-n', '2', ip], shell=True)
    if response == 0:
        label.config(text=f'pc with index {index} off')
        label.pack()
    else:
        ind += 1

if ind == len(ips):
    label.config(text=f'ALL ONLINE')
    label.pack()
→ Ссылка