guyuehhh 发表于 2017-4-23 10:07:09

Python 获取网页内容

Python 获取网页内容


  url = 'http://www.XXX.com'

1. 使用urllib or urllib2

import urllib2
urllib2.urlopen( url ).read()
urllib2.urlopen( url ).read().decode('utf-8')

2. python调用 curl

import os, sys
os.system('curl ' + url)
os.system('curl -D header.txt ' + url)
页: [1]
查看完整版本: Python 获取网页内容