用BeautifulSoup提取网页内容时有时无显示

我想要用python提取新浪财经文章的html,在控制台输出.用了BeautifulSoup,代码如下:

# -*- coding: utf-8 -*-

from bs4 import BeautifulSoup
import re
import urllib
import urllib2

url='http://finance.sina.com.cn/stock/t/2015-12-16/doc-ifxmszek7156687.shtml'
user_agent='Mozilla/4.0(compatible;MSIE 5.5;Windows NT)'
headers={'User-Agent':user_agent}
try:
    request=urllib2.Request(url,headers=headers)
    response=urllib2.urlopen(request)
    content=BeautifulSoup(response)
    print content
except  urllib2.URLError,e:
       if hasattr(e,"code"):
          print e.code
       if hasattr(e,"reason"):
          print e.reason

但是问题是,运行时,content的内容不能每次都在控制台输出,需要多运行几次.有时运行结果如下图:

再多运行几次,才会有输出结果

查看回复