1: 2: 3: 4: 5: 6: 7: 8:
myFile = open("data.txt","r") for line in myFile.readlines(): if line.find("PORT"): ip = line.split("=")[1] print "PORT: " + str(ip) elif line.find("IP_ADDRESS"): port = line.split("=")[1] print "IP: " + str(port)
1: 2: 3: 4: 5: 6: 7: 8: 9:
myFile = open("data.txt","r") for line in myFile.readlines(): line = line.strip() if "PORT" in line: port = line.split("=")[1] print "PORT: " + str(port) elif "IP_ADDRESS" in line: ip = line.split("=")[1] print "IP: " + str(ip)