Python 对新浪微博的博文元素 (Word, Screen Name)的频率分析
2016-04-05 20:27
579 查看
CODE:
RESULT:
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-9 @author: guaguastd @name: weiboFrequencyAnalysis.py ''' if __name__ == '__main__': # get weibo_api to access sina api from sinaWeiboLogin import sinaWeiboLogin sinaWeiboApi = sinaWeiboLogin() # import sinaWeibo from sinaWeibo import extractWeiboEntities # import sinaWeoboStatuses from sinaWeiboStatuses import publicTimeline # import sinaWeiboFrequency from sinaWeiboFrequency import weiboFrequencyAnalysis # get the new 5 weibo weiboNum = 5 statuses = publicTimeline(sinaWeiboApi, weiboNum) status_texts,screen_names,words = extractWeiboEntities(statuses) for label, data in (('Word', words), ('Screen Name', screen_names)): weiboFrequencyAnalysis(label, data, weiboNum)
RESULT:
+------------------------------------------+-------+ | Word | Count | +------------------------------------------+-------+ | http://t.cn/8snKY0S | 1 | | [围观]CANNCI千姿百袋2014新款牛皮菱格女包 | 1 | | 时尚潮流单肩包 | 1 | | 浪漫RI系「喜欢请赞 | 1 | | ✲✲✲✲✲✲ | 1 | +------------------------------------------+-------+ +--------------------+-------+ | Screen Name | Count | +--------------------+-------+ | 马傻强 | 1 | | 手机用户2360148561 | 1 | | 潮流爆款搭V | 1 | | star爱上泡面猫 | 1 | | 美容潮搭健康 | 1 | +--------------------+-------+
相关文章推荐
- Python列表和元组
- GDB 编译--with-python unusable python问题
- python get方法
- 关于Python 中的 map()函数
- Python优雅编程技巧
- 数据分类K—means 算法的python代码实现
- Python~~~关键字~~~
- python time 与datetime之间的区别与联系
- Python~迭代
- python time 与datetime之间的区别与联系
- Python描述符(descriptor)解密
- Python~切片Slice
- python version 2.7 required,which was not found in the registry
- 理解Python中的with…as…语法
- Python如何安装egg组件
- python常用内置模块,执行系统命令的模块
- Leetcode 15. 3Sum(python)
- Python3.5入门学习记录-条件控制
- odoo8新旧API related字段类型详解
- python小技巧