python獲取遠程頁面內容,避免卡死問題 Posted on 2018-07-31 範例: import urllib2 import time print time.time() try: url = "http://localhost/test.php" f = urllib2.urlopen(url, timeout=5) print f.readlines() except Exception, e: print e print time.time()