jeudi 4 décembre 2014

unable to compare ip address in python


Vote count:

0




my code looks like this



from socket import gethostbyname, gethostname
with open('LoggedIn.csv', 'r') as csvfile:
aList = []
for line in csvfile.readlines():
array = line.split(',')
aList.append(array[2])
ip = gethostbyname(gethostname())

if ip in aList:
x = 1
else:
x = 0


when I got the user's ip address and there is the same ip address in my LoggedIn.csv file the if statement just return false.


Thank you!



asked 1 min ago







unable to compare ip address in python

Aucun commentaire:

Enregistrer un commentaire