def latest_content(url):
 try:
  html = lxml.html.parse(url)
  res = html.xpath('//div[@id="artibody"]/p')
  if ct.PY3:
   sarr = [etree.tostring(node).decode('utf-8') for node in res]
  else:
   sarr = [etree.tostring(node) for node in res]
  sarr = ''.join(sarr).replace('&#12288;', '')
  html_content = lxml.html.fromstring(sarr)
  content = html_content.text_content()
  return content
 except Exception as er:
  print str(er)

def latest_content ( url ) : try : html = lxml . html . parse ( url ) res = html . xpath ( '//div[@id="artibody"]/p' ) if ct . PY3 : sarr = [ etree . tostring ( node ) . decode ( 'utf-8' ) for node in res ] else : sarr = [ etree . tostring ( node ) for node in res ] sarr = '' . join ( sarr ) . replace ( '&#12288;' , '' ) html_content = lxml . html . fromstring ( sarr ) content = html_content . text_content ( ) return content except Exception as er : print str ( er )
parameter url:新闻链接 return string:返回新闻的文字内容 .