Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1309068
  • 博文数量: 268
  • 博客积分: 10698
  • 博客等级: 上将
  • 技术积分: 2867
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-14 22:21
文章分类

全部博文(268)

文章存档

2012年(19)

2011年(13)

2010年(29)

2009年(26)

2008年(99)

2007年(82)

我的朋友

分类: Python/Ruby

2008-08-04 02:58:27

# apt-get install python-feedparser
# python
Python 2.5.2 (r252:60911, Jul 12 2008, 12:02:40)
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import feedparser
>>> d = feedparser.parse('')
>>> d.encoding
'windows-1252'
>>> d.status
200
>>> d = feedparser.parse('http://control.cublog.cn')
>>> d.encoding
'GB2312'
>>> d.status
302
>>> d.href
'http://control.cublog.cn/login.php?back=index.php'
>>> d = feedparser.parse('')
>>> d.encoding
'UTF-8'
>>> d.status
301
>>> d = feedparser.parse('')
>>> d.encoding
'EUC-KR'
>>> d = feedparser.parse('')
>>> d.encoding
'ISO-8859-1'
>>> d.headers
{'content-language': 'en', 'transfer-encoding': 'chunked', 'accept-ranges': 'bytes', 'expires': 'Sun, 03 Aug 2008 19:05:00 GMT', 'server': 'Apache', 'connection': 'close', 'pragma': 'no-cache', 'cache-control': 'no-cache', 'date': 'Sun, 03 Aug 2008 19:04:00 GMT', 'content-type': 'text/html; charset=ISO-8859-1'}

阅读(1757) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~