试图弄清楚为什么我无法将 IP 的输出与设置的 IP 匹配并因此呈现结果。
import urllib
import re
ip = '212.125.222.196'
url = "http://checkip.dyndns.org"
print url
request = urllib.urlopen(url).read()
theIP = re.findall(r"\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,3}", request)
print "your IP Address is: ", theIP
if theIP == '211.125.122.192':
print "You are OK"
else:
print "BAAD"
结果总是“BAAD”