#coding='utf-8'
import os,sys
from random import sample
import time
import datetime
truelist = []
falselist = []
IP = ['192.168.1.1','192.168.0.1','192.168.1.2']
f = open(datetime.datetime.now().strftime("%Y%m%d%H%M%S") + ".txt", "w")
for i in sample(IP,2):
ping = os.system('ping -c 3 %s'%i)
if ping:
falselist.append(i)
else:
truelist.append(i)
print('truelist:' + str(truelist), file = f)
print('falselist:' + str(falselist), file = f)
f.close()