import urillb2
response=urilb2.urlopen('http:www.baidu.com')//直接请求
printf response.getcode()//获取状态码
cont = response.read()//读取内容
response=urilb2.urlopen('http:www.baidu.com')//直接请求
printf response.getcode()//获取状态码
cont = response.read()//读取内容
2016-03-15
有出现这个错误吗? 'str' object has no attribute 'soup'
2016-03-14
python 3 'third' tips
import http.cookiejar
cj = http.cookiejar.CookieJar()
import http.cookiejar
cj = http.cookiejar.CookieJar()
2016-03-12
add_data应该这么写:
In [4]: args = urllib.urlencode({"feed_id":""})
In [5]: request.add_data(args)
In [4]: args = urllib.urlencode({"feed_id":""})
In [5]: request.add_data(args)
2016-03-11
python,windows10版本,输出的HTML乱码的同学,不需要在fout.write("<td>%s</td>"%data['title'])以及后面的summary中添加.encode(utf-8),只要fout = open('output.html','w',encoding='utf-8') 就行。感谢@明磊同学,具体的原理也可以参见@明磊的评论。
2016-03-07