#---------------------------------import---------------------------------------
import urllib2;
import re;
#------------------------------------------------------------------------------
def main():
userMainUrl = "192.168.50.230:50182/cgi-bin/luci";
req = urllib2.Request(userMainUrl);
resp = urllib2.urlopen(req);
respHtml = resp.read();
print ("respHtml="),respHtml; # you should see the ouput html
#<h1 class="h1user">crifan</h1>
foundH1user = re.search('<span\s+?id="vers">(?P<vers>.+?)</span>', respHtml);
print ("foundH1user="),foundH1user;
if(foundH1user):
h1user = foundH1user.group("vers");
print ("h1user="),h1user;
###############################################################################
if __name__=="__main__":
main();
写了这段程序,运行的时候为什么说urllib2.URLError:<urlopen error unknow url type:192.168.50.230>
是不是不能访问IP地址?
import urllib2;
import re;
#------------------------------------------------------------------------------
def main():
userMainUrl = "192.168.50.230:50182/cgi-bin/luci";
req = urllib2.Request(userMainUrl);
resp = urllib2.urlopen(req);
respHtml = resp.read();
print ("respHtml="),respHtml; # you should see the ouput html
#<h1 class="h1user">crifan</h1>
foundH1user = re.search('<span\s+?id="vers">(?P<vers>.+?)</span>', respHtml);
print ("foundH1user="),foundH1user;
if(foundH1user):
h1user = foundH1user.group("vers");
print ("h1user="),h1user;
###############################################################################
if __name__=="__main__":
main();
写了这段程序,运行的时候为什么说urllib2.URLError:<urlopen error unknow url type:192.168.50.230>
是不是不能访问IP地址?