url = raw_input('Enter - ') if (re.search('^http://[a-zA-Z0-9]+.[a-zA-Z0-9]+.[a-zA-Z0-9]+/',url)): try: web = urllib.urlopen(url) except: print(url, ' is not a correct server') exit() count = 0 while True: data = web.read(3000) if (len(data) < 1) : break count = count + len(data) if (count <= 3000): print (data.decode('utf-8')) print("The total count of this web is", count) else: print("The URL that you input is bad format")
近期评论