python 3.3 爬取网页信息 小例

# -*- 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 3.3 爬取网页信息 小例_第1张图片


其它例子:

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

你可能感兴趣的:(python 3.3 爬取网页信息 小例)