现在的位置: 首页 > 综合 > 正文

python 3.3 爬取网页信息 小例 Python抓取网页  python 3.3

2013年08月18日 ⁄ 综合 ⁄ 共 592字 ⁄ 字号 评论关闭
# -*- coding:gb2312 -*-    
import urllib.request
source_stram = urllib.request.urlopen("http://www.12306.cn/mormhweb/kyfw/")
#save_path="D:\\baiDuYun\\百度云\\Code\\DotNet\\Download\\Python\\testPythonFiles\\instance_snatch_web\\snatch2.txt"
save_path="D:\\snatch2.txt" 
# save_path 's file unnecessary to be exist
f_obj = open(save_path,'wb')
f_obj.write(source_stram.read())
print("snatch successfully.")

运行效果:

其它例子:

Python抓取网页  python 3.3

http://blog.csdn.net/cay22/article/details/8636623

python3.x中的urllib模块

http://my.oschina.net/u/999436/blog/113317

python 3.0 change log:

http://www.python.org/download/releases/3.0.1/NEWS.txt

抱歉!评论已关闭.