for each in cursor fetchall login segment name street bnum apart each

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
for each in cursor.fetchall():
login,segment,name,street,bnum,apart = each
if bin2ip(segment).startswith('192.168.33.'):
output = ""
elif bin2ip(segment).startswith('195.22.105.') and int(bin2ip(segment).split('.')[-1]) > 100:
output = ""
else:
output = login + ";" + bin2ip(segment) + ";" + name + ";" + street + " " + bnum + "-" + apart
if output:
print output.encode('utf8')