鱼C论坛

 找回密码
 立即注册
查看: 3758|回复: 34

[已解决]关于json数据集如何处理

[复制链接]
发表于 2020-11-25 18:24:53 | 显示全部楼层 |阅读模式
60鱼币
本帖最后由 昨非 于 2020-11-25 19:32 编辑

天道好轮回


        终于有一天,我也会因为课内项目要用到数据处理来这里发帖求助,
        之前直接跳过了爬虫那部分,这东西没用过是真搞不定
                大致要求是进行舆情分析(数据来自微博)
悬赏鱼币有上限这个不好处理,不过四位数以下都好商量

        了解到直接抛个项目来肯定没人看,所以只需要大家告诉我:
        我需要用到哪些工具
        需要学哪些东西
        或者这类型的数据集一般要怎么处理?
        哪些部分能用,哪些部分不能?
        怎么把它转换成能看懂的格式?

        就足够了
                补充一点,数据集大概有1个G,所以(对我)要求可能有些苛刻,我需要更多信息指导
                我尽量不亏待每一个回答的人
大致需要的位置在

                               
登录/注册后可看大图


整个json超过五万字符,发不上来,见谅
数据大致格式如下:




  1. {"statuses":[{"created_at":"Mon Jul 30 23:59:28 +0800 2012","id":3473640819621095,"mid":"3473640819621095","idstr":"3473640819621095","text":"\/\/@\u7b11\u591a\u4e86\u4f1a\u53d8\u6001:\u5317\u4eac\u66b4\u96e8\u81f4\u4f7f\u6709\u4eba\u6253\u4e0d\u5f00\u8f66\u95e8\u9020\u6210\u6eba\u4ea1\uff0c\u5176\u5b9e\u88ab\u56f0\u5728\u8f66\u91cc\u9003\u751f\u65f6","source":"<a href="http:\/\/m.weibo.com\/web\/cellphone.php#iphone" rel="nofollow">iPhone\u5ba2\u6237\u7aef<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":2701566162,"idstr":"2701566162","screen_name":"\u51b0\u51b0DENG","name":"\u51b0\u51b0DENG","province":"35","city":"2","location":"\u798f\u5efa \u53a6\u95e8","description":"","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/2701566162\/50\/5645060822\/0","profile_url":"u\/2701566162","domain":"","weihao":"","gender":"f","followers_count":585,"friends_count":188,"statuses_count":2625,"favourites_count":299,"created_at":"Thu May 10 00:39:00 +0800 2012","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"allow_all_comment":false,"avatar_large":"http:\/\/tp3.sinaimg.cn\/2701566162\/180\/5645060822\/0","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":48,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"","id":3472139069968229,"mid":"3472139069968229","idstr":"3472139069968229","text":"\u62b1\u6b49\uff0c\u6b64\u5fae\u535a\u5df2\u88ab\u4f5c\u8005\u5220\u9664\u3002\u67e5\u770b\u5e2e\u52a9\uff1ahttp:\/\/t.cn\/zWSudZc","state":7,"deleted":"1"},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:57:36 +0800 2012","id":3473640337422006,"mid":"3473640337422006","idstr":"3473640337422006","text":"\u5a01\u5c3c\u65af\u5f53\u5730\u65f6\u95f49\u67083\u65e5\u665a7\u70b9\uff0c\u9614\u522b\u94f6\u5e55\u591a\u65f6\u7684\u5f20\u66fc\u7389\u5e26\u7740\u4e24\u90e8\u51fa\u6f14\u7684\u77ed\u7247\u56de\u5230\u805a\u5149\u706f\u524d\uff0c\u5728\u5176\u4e2d\u4e00\u90e8\u8bb2\u8ff0\u4e2d\u56fd\u975e\u6cd5\u79fb\u6c11\u5728\u82f1\u56fd\u6d77\u6ee9\u62fe\u8d1d\u9047\u96be\u4e8b\u4ef6\u7684\u77ed\u7247\u4e2d\uff0c\u5f20\u66fc\u7389\u66f4\u662f\u4ee5\u6beb\u65e0\u53f0\u8bcd\u7684\u798f\u5efa\u4e00\u5e26\u5973\u795e\u5988\u7956\u4e00\u89d2\u51fa\u955c\u3002","source":"<a href="http:\/\/itunes.apple.com\/cn\/app\/isinaweibo\/id375364700?mt=8" rel="nofollow">iPhone\u5fae\u535a\u52a9\u624b<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","thumbnail_pic":"http:\/\/ww1.sinaimg.cn\/thumbnail\/a53b39d6jw1dvfb6z6ktpj.jpg","bmiddle_pic":"http:\/\/ww1.sinaimg.cn\/bmiddle\/a53b39d6jw1dvfb6z6ktpj.jpg","original_pic":"http:\/\/ww1.sinaimg.cn\/large\/a53b39d6jw1dvfb6z6ktpj.jpg","geo":null,"user":{"id":2772122070,"idstr":"2772122070","screen_name":"lovecamin","name":"lovecamin","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/2772122070\/50\/5631795130\/1","profile_url":"u\/2772122070","domain":"","weihao":"","gender":"m","followers_count":68,"friends_count":515,"statuses_count":136,"favourites_count":0,"created_at":"Sat May 12 21:02:41 +0800 2012","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"allow_all_comment":true,"avatar_large":"http:\/\/tp3.sinaimg.cn\/2772122070\/180\/5631795130\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":9,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:57:32 +0800 2012","id":3473640320267576,"mid":"3473640320267576","idstr":"3473640320267576","text":"\u6536\u5230\u5317\u4eac\u66b4\u96e8\u63d0\u793a\u77ed\u4fe1\uff1a\u5e02\u6c14\u8c61\u53f019\u65f635\u5206\u53d1\u5e03\u66b4\u96e8\u84dd\u8272\u9884\u8b66\u4fe1\u53f7\uff1a\u672a\u67653\u5c0f\u65f6\u623f\u5c71\u4e1c\u90e8\u3001\u5927\u5174\u3001\u57ce\u516d\u533a\u3001\u901a\u5dde\u7b49\u5730\u96e8\u91cf\u5c06\u8d85\u8fc730\u6beb\u7c73\uff0c\u57ce\u533a\u9632\u79ef\u6c34\uff0c\u5c71\u533a\u707e\u533a\u9632\u5730\u8d28\u707e\u5bb3","source":"<a href="http:\/\/m.weibo.com\/web\/cellphone.php#iphone" rel="nofollow">iPhone\u5ba2\u6237\u7aef<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","thumbnail_pic":"http:\/\/ww2.sinaimg.cn\/thumbnail\/53789a0ajw1dvfb6vlhfmj.jpg","bmiddle_pic":"http:\/\/ww2.sinaimg.cn\/bmiddle\/53789a0ajw1dvfb6vlhfmj.jpg","original_pic":"http:\/\/ww2.sinaimg.cn\/large\/53789a0ajw1dvfb6vlhfmj.jpg","geo":null,"user":{"id":1400412682,"idstr":"1400412682","screen_name":"yangfan","name":"yangfan","province":"11","city":"8","location":"\u5317\u4eac \u6d77\u6dc0\u533a","description":"\u51ef\u91cc\u795e","url":"http:\/\/blog.sina.com.cn\/claudio","profile_image_url":"http:\/\/tp3.sinaimg.cn\/1400412682\/50\/1279878142\/1","profile_url":"claudio","domain":"claudio","weihao":"","gender":"m","followers_count":14502,"friends_count":1335,"statuses_count":3870,"favourites_count":21,"created_at":"Fri Aug 28 16:34:24 +0800 2009","following":false,"allow_all_act_msg":true,"geo_enabled":true,"verified":true,"verified_type":0,"allow_all_comment":true,"avatar_large":"http:\/\/tp3.sinaimg.cn\/1400412682\/180\/1279878142\/1","verified_reason":"\u65b0\u6d6a\u8fd0\u8425\u90e8\u5fae\u535a\u9891\u9053 \u6768\u5e06","follow_me":false,"online_status":0,"bi_followers_count":520,"lang":"zh-cn","star":0,"mbtype":12,"mbrank":2,"block_word":0,"ulevel":0},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:56:42 +0800 2012","id":3473640123459395,"mid":"3473640123459395","idstr":"3473640123459395","text":"\u5317\u4eac\u66b4\u96e8\u53d7\u707e\u4e3a\u4f55\u4e0d\u89c1\u54ed\uff1f","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":2430690160,"idstr":"2430690160","screen_name":"\u6211\u7cfb\u96f7\u4eba","name":"\u6211\u7cfb\u96f7\u4eba","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"","url":"","profile_image_url":"http:\/\/tp1.sinaimg.cn\/2430690160\/50\/5613491627\/1","profile_url":"u\/2430690160","domain":"","weihao":"","gender":"m","followers_count":58,"friends_count":185,"statuses_count":598,"favourites_count":301,"created_at":"Thu Sep 29 08:09:58 +0800 2011","following":false,"allow_all_act_msg":false,"geo_enabled":false,"verified":false,"verified_type":-1,"allow_all_comment":true,"avatar_large":"http:\/\/tp1.sinaimg.cn\/2430690160\/180\/5613491627\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":25,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"Mon Jul 30 23:10:12 +0800 2012","id":3473628421535818,"mid":"3473628421535818","idstr":"3473628421535818","text":"\u603b\u7406\u5728\u54ea\u91cc\uff1f\u539f\u6765\u5728\u5f00\u4f1a\u3002\u6e29\u603b\uff1a\u5c3d\u5feb\u63a8\u4e00\u6279\u6c11\u95f4\u6295\u8d44\u53c2\u4e0e\u7684\u91cd\u70b9\u9879\u76ee","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":1680497944,"idstr":"1680497944","screen_name":"\u53e4\u6587\u667a","name":"\u53e4\u6587\u667a","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"\u8d22\u7ecf\u4e3b\u6301\u3001\u8bb2\u5ea7\u7b56\u5212\u3001\u5584\u89c2\u5bdf\u5e76\u601d\u8003\uff0c\u7ea6\u7a3f\u3001\u7ea6\u8bb2\u5ea7\u8bf7\u79c1\u4fe1","url":"","profile_image_url":"http:\/\/tp1.sinaimg.cn\/1680497944\/50\/1279886572\/1","profile_url":"u\/1680497944","domain":"","weihao":"","gender":"m","followers_count":9178,"friends_count":437,"statuses_count":1100,"favourites_count":170,"created_at":"Mon Jan 11 12:23:22 +0800 2010","following":false,"allow_all_act_msg":true,"geo_enabled":true,"verified":true,"verified_type":0,"allow_all_comment":true,"avatar_large":"http:\/\/tp1.sinaimg.cn\/1680497944\/180\/1279886572\/1","verified_reason":"\u5e7f\u4e1c\u7535\u53f0\u80a1\u5e02\u53f0\u77e5\u540d\u8282\u76ee\u4e3b\u6301\u4eba \u53e4\u6587\u667a","follow_me":false,"online_status":0,"bi_followers_count":218,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"reposts_count":2,"comments_count":14,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:56:27 +0800 2012","id":3473640047943266,"mid":"3473640047943266","idstr":"3473640047943266","text":"[\u881f\u71ed]\/\/@\u7075\u6027\u4e4b\u74f6: [\u8721\u70db]\/\/@\u8463\u51c0\u5fc3: [\u8721\u70db]\/\/@\u5999\u97f3\u667a\u51ef: [\u8721\u70db]\/\/@\u6210\u5c31\u6df1\u4fe1: [\u8721\u70db][\u8721\u70db][\u8721\u70db] \/\/@\u6625\u83ef\u79cb\u5be6\u5fae\u8bed\u5f55: \u963f\u5f25\u9640\u4f5b\uff01[\u881f\u71ed]\u8ba9\u6211\u4eec\u5171\u540c\u7948\u7977\u5317\u4eac\u5929\u6d25[\u5fc3]\u53ca7.21\u9047\u96be\u4ea1\u7075\u5f97\u751f\u51c0\u571f\uff1b\u7948\u613f\u53d7\u707e\u7fa4\u4f17\u65e9\u65e5\u6062\u590d\u5f80\u65e5\u7684\u5bb6\u56ed\u3002 [\u881f\u71ed][\u881f\u71ed][\u881f\u71ed]\u613f\u751f\u8005\u5409\u7965\u5b89\u4e50 \u901d\u8005\u8131\u79bb\u82e6\u96be\uff01[\u881f\u71ed]","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":1966481342,"idstr":"1966481342","screen_name":"\u963f\u59c6\u601d","name":"\u963f\u59c6\u601d","province":"32","city":"5","location":"\u6c5f\u82cf \u82cf\u5dde","description":"\u6709\u5922\u6700\u7f8e,\u5e0c\u671b\u76f8\u96a8!","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/1966481342\/50\/5636031348\/1","profile_url":"u\/1966481342","domain":"","weihao":"","gender":"m","followers_count":1105,"friends_count":727,"statuses_count":3245,"favourites_count":117,"created_at":"Tue Mar 01 00:01:33 +0800 2011","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":220,"allow_all_comment":false,"avatar_large":"http:\/\/tp3.sinaimg.cn\/1966481342\/180\/5636031348\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":716,"lang":"zh-tw","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"Fri Jul 27 18:50:32 +0800 2012","id":3472475897393643,"mid":"3472475897393643","idstr":"3472475897393643",
复制代码


如果数据截取不全,或格式有问题,还望及时告知哈
最佳答案
2020-11-25 18:24:54
昨非 发表于 2020-11-25 21:59
好吧,我回头先操作下试试,有什么问题再来请教,多谢了

比如这样,找出暴雨和总理两个关键词
  1. import re

  2. data = '''{"statuses":[{"created_at":"Mon Jul 30 23:59:28 +0800 2012","id":3473640819621095,"mid":"3473640819621095","idstr":"3473640819621095","text":"\/\/@\u7b11\u591a\u4e86\u4f1a\u53d8\u6001:\u5317\u4eac\u66b4\u96e8\u81f4\u4f7f\u6709\u4eba\u6253\u4e0d\u5f00\u8f66\u95e8\u9020\u6210\u6eba\u4ea1\uff0c\u5176\u5b9e\u88ab\u56f0\u5728\u8f66\u91cc\u9003\u751f\u65f6","source":"<a href="http:\/\/m.weibo.com\/web\/cellphone.php#iphone" rel="nofollow">iPhone\u5ba2\u6237\u7aef<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":2701566162,"idstr":"2701566162","screen_name":"\u51b0\u51b0DENG","name":"\u51b0\u51b0DENG","province":"35","city":"2","location":"\u798f\u5efa \u53a6\u95e8","description":"","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/2701566162\/50\/5645060822\/0","profile_url":"u\/2701566162","domain":"","weihao":"","gender":"f","followers_count":585,"friends_count":188,"statuses_count":2625,"favourites_count":299,"created_at":"Thu May 10 00:39:00 +0800 2012","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"allow_all_comment":false,"avatar_large":"http:\/\/tp3.sinaimg.cn\/2701566162\/180\/5645060822\/0","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":48,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"","id":3472139069968229,"mid":"3472139069968229","idstr":"3472139069968229","text":"\u62b1\u6b49\uff0c\u6b64\u5fae\u535a\u5df2\u88ab\u4f5c\u8005\u5220\u9664\u3002\u67e5\u770b\u5e2e\u52a9\uff1ahttp:\/\/t.cn\/zWSudZc","state":7,"deleted":"1"},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:57:36 +0800 2012","id":3473640337422006,"mid":"3473640337422006","idstr":"3473640337422006","text":"\u5a01\u5c3c\u65af\u5f53\u5730\u65f6\u95f49\u67083\u65e5\u665a7\u70b9\uff0c\u9614\u522b\u94f6\u5e55\u591a\u65f6\u7684\u5f20\u66fc\u7389\u5e26\u7740\u4e24\u90e8\u51fa\u6f14\u7684\u77ed\u7247\u56de\u5230\u805a\u5149\u706f\u524d\uff0c\u5728\u5176\u4e2d\u4e00\u90e8\u8bb2\u8ff0\u4e2d\u56fd\u975e\u6cd5\u79fb\u6c11\u5728\u82f1\u56fd\u6d77\u6ee9\u62fe\u8d1d\u9047\u96be\u4e8b\u4ef6\u7684\u77ed\u7247\u4e2d\uff0c\u5f20\u66fc\u7389\u66f4\u662f\u4ee5\u6beb\u65e0\u53f0\u8bcd\u7684\u798f\u5efa\u4e00\u5e26\u5973\u795e\u5988\u7956\u4e00\u89d2\u51fa\u955c\u3002","source":"<a href="http:\/\/itunes.apple.com\/cn\/app\/isinaweibo\/id375364700?mt=8" rel="nofollow">iPhone\u5fae\u535a\u52a9\u624b<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","thumbnail_pic":"http:\/\/ww1.sinaimg.cn\/thumbnail\/a53b39d6jw1dvfb6z6ktpj.jpg","bmiddle_pic":"http:\/\/ww1.sinaimg.cn\/bmiddle\/a53b39d6jw1dvfb6z6ktpj.jpg","original_pic":"http:\/\/ww1.sinaimg.cn\/large\/a53b39d6jw1dvfb6z6ktpj.jpg","geo":null,"user":{"id":2772122070,"idstr":"2772122070","screen_name":"lovecamin","name":"lovecamin","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/2772122070\/50\/5631795130\/1","profile_url":"u\/2772122070","domain":"","weihao":"","gender":"m","followers_count":68,"friends_count":515,"statuses_count":136,"favourites_count":0,"created_at":"Sat May 12 21:02:41 +0800 2012","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"allow_all_comment":true,"avatar_large":"http:\/\/tp3.sinaimg.cn\/2772122070\/180\/5631795130\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":9,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:57:32 +0800 2012","id":3473640320267576,"mid":"3473640320267576","idstr":"3473640320267576","text":"\u6536\u5230\u5317\u4eac\u66b4\u96e8\u63d0\u793a\u77ed\u4fe1\uff1a\u5e02\u6c14\u8c61\u53f019\u65f635\u5206\u53d1\u5e03\u66b4\u96e8\u84dd\u8272\u9884\u8b66\u4fe1\u53f7\uff1a\u672a\u67653\u5c0f\u65f6\u623f\u5c71\u4e1c\u90e8\u3001\u5927\u5174\u3001\u57ce\u516d\u533a\u3001\u901a\u5dde\u7b49\u5730\u96e8\u91cf\u5c06\u8d85\u8fc730\u6beb\u7c73\uff0c\u57ce\u533a\u9632\u79ef\u6c34\uff0c\u5c71\u533a\u707e\u533a\u9632\u5730\u8d28\u707e\u5bb3","source":"<a href="http:\/\/m.weibo.com\/web\/cellphone.php#iphone" rel="nofollow">iPhone\u5ba2\u6237\u7aef<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","thumbnail_pic":"http:\/\/ww2.sinaimg.cn\/thumbnail\/53789a0ajw1dvfb6vlhfmj.jpg","bmiddle_pic":"http:\/\/ww2.sinaimg.cn\/bmiddle\/53789a0ajw1dvfb6vlhfmj.jpg","original_pic":"http:\/\/ww2.sinaimg.cn\/large\/53789a0ajw1dvfb6vlhfmj.jpg","geo":null,"user":{"id":1400412682,"idstr":"1400412682","screen_name":"yangfan","name":"yangfan","province":"11","city":"8","location":"\u5317\u4eac \u6d77\u6dc0\u533a","description":"\u51ef\u91cc\u795e","url":"http:\/\/blog.sina.com.cn\/claudio","profile_image_url":"http:\/\/tp3.sinaimg.cn\/1400412682\/50\/1279878142\/1","profile_url":"claudio","domain":"claudio","weihao":"","gender":"m","followers_count":14502,"friends_count":1335,"statuses_count":3870,"favourites_count":21,"created_at":"Fri Aug 28 16:34:24 +0800 2009","following":false,"allow_all_act_msg":true,"geo_enabled":true,"verified":true,"verified_type":0,"allow_all_comment":true,"avatar_large":"http:\/\/tp3.sinaimg.cn\/1400412682\/180\/1279878142\/1","verified_reason":"\u65b0\u6d6a\u8fd0\u8425\u90e8\u5fae\u535a\u9891\u9053 \u6768\u5e06","follow_me":false,"online_status":0,"bi_followers_count":520,"lang":"zh-cn","star":0,"mbtype":12,"mbrank":2,"block_word":0,"ulevel":0},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:56:42 +0800 2012","id":3473640123459395,"mid":"3473640123459395","idstr":"3473640123459395","text":"\u5317\u4eac\u66b4\u96e8\u53d7\u707e\u4e3a\u4f55\u4e0d\u89c1\u54ed\uff1f","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":2430690160,"idstr":"2430690160","screen_name":"\u6211\u7cfb\u96f7\u4eba","name":"\u6211\u7cfb\u96f7\u4eba","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"","url":"","profile_image_url":"http:\/\/tp1.sinaimg.cn\/2430690160\/50\/5613491627\/1","profile_url":"u\/2430690160","domain":"","weihao":"","gender":"m","followers_count":58,"friends_count":185,"statuses_count":598,"favourites_count":301,"created_at":"Thu Sep 29 08:09:58 +0800 2011","following":false,"allow_all_act_msg":false,"geo_enabled":false,"verified":false,"verified_type":-1,"allow_all_comment":true,"avatar_large":"http:\/\/tp1.sinaimg.cn\/2430690160\/180\/5613491627\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":25,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"Mon Jul 30 23:10:12 +0800 2012","id":3473628421535818,"mid":"3473628421535818","idstr":"3473628421535818","text":"\u603b\u7406\u5728\u54ea\u91cc\uff1f\u539f\u6765\u5728\u5f00\u4f1a\u3002\u6e29\u603b\uff1a\u5c3d\u5feb\u63a8\u4e00\u6279\u6c11\u95f4\u6295\u8d44\u53c2\u4e0e\u7684\u91cd\u70b9\u9879\u76ee","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":1680497944,"idstr":"1680497944","screen_name":"\u53e4\u6587\u667a","name":"\u53e4\u6587\u667a","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"\u8d22\u7ecf\u4e3b\u6301\u3001\u8bb2\u5ea7\u7b56\u5212\u3001\u5584\u89c2\u5bdf\u5e76\u601d\u8003\uff0c\u7ea6\u7a3f\u3001\u7ea6\u8bb2\u5ea7\u8bf7\u79c1\u4fe1","url":"","profile_image_url":"http:\/\/tp1.sinaimg.cn\/1680497944\/50\/1279886572\/1","profile_url":"u\/1680497944","domain":"","weihao":"","gender":"m","followers_count":9178,"friends_count":437,"statuses_count":1100,"favourites_count":170,"created_at":"Mon Jan 11 12:23:22 +0800 2010","following":false,"allow_all_act_msg":true,"geo_enabled":true,"verified":true,"verified_type":0,"allow_all_comment":true,"avatar_large":"http:\/\/tp1.sinaimg.cn\/1680497944\/180\/1279886572\/1","verified_reason":"\u5e7f\u4e1c\u7535\u53f0\u80a1\u5e02\u53f0\u77e5\u540d\u8282\u76ee\u4e3b\u6301\u4eba \u53e4\u6587\u667a","follow_me":false,"online_status":0,"bi_followers_count":218,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"reposts_count":2,"comments_count":14,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:56:27 +0800 2012","id":3473640047943266,"mid":"3473640047943266","idstr":"3473640047943266","text":"[\u881f\u71ed]\/\/@\u7075\u6027\u4e4b\u74f6: [\u8721\u70db]\/\/@\u8463\u51c0\u5fc3: [\u8721\u70db]\/\/@\u5999\u97f3\u667a\u51ef: [\u8721\u70db]\/\/@\u6210\u5c31\u6df1\u4fe1: [\u8721\u70db][\u8721\u70db][\u8721\u70db] \/\/@\u6625\u83ef\u79cb\u5be6\u5fae\u8bed\u5f55: \u963f\u5f25\u9640\u4f5b\uff01[\u881f\u71ed]\u8ba9\u6211\u4eec\u5171\u540c\u7948\u7977\u5317\u4eac\u5929\u6d25[\u5fc3]\u53ca7.21\u9047\u96be\u4ea1\u7075\u5f97\u751f\u51c0\u571f\uff1b\u7948\u613f\u53d7\u707e\u7fa4\u4f17\u65e9\u65e5\u6062\u590d\u5f80\u65e5\u7684\u5bb6\u56ed\u3002 [\u881f\u71ed][\u881f\u71ed][\u881f\u71ed]\u613f\u751f\u8005\u5409\u7965\u5b89\u4e50 \u901d\u8005\u8131\u79bb\u82e6\u96be\uff01[\u881f\u71ed]","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":1966481342,"idstr":"1966481342","screen_name":"\u963f\u59c6\u601d","name":"\u963f\u59c6\u601d","province":"32","city":"5","location":"\u6c5f\u82cf \u82cf\u5dde","description":"\u6709\u5922\u6700\u7f8e,\u5e0c\u671b\u76f8\u96a8!","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/1966481342\/50\/5636031348\/1","profile_url":"u\/1966481342","domain":"","weihao":"","gender":"m","followers_count":1105,"friends_count":727,"statuses_count":3245,"favourites_count":117,"created_at":"Tue Mar 01 00:01:33 +0800 2011","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":220,"allow_all_comment":false,"avatar_large":"http:\/\/tp3.sinaimg.cn\/1966481342\/180\/5636031348\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":716,"lang":"zh-tw","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"Fri Jul 27 18:50:32 +0800 2012","id":3472475897393643,"mid":"3472475897393643","idstr":"3472475897393643",'''
  3. result=re.findall('"text":(.*?),', data)
  4. print(result)
  5. print()
  6. for a in result:
  7.     t=re.search(r'暴雨|总理', a)
  8.     if t !=None:
  9.         print(a)
复制代码

"\/\/@笑多了会变态:北京暴雨致使有人打不开车门造成溺亡,其实被困在车里逃生时"
"收到北京暴雨提示短信:市气象台19时35分发布暴雨蓝色预警信号:未来3小时房山东部、大兴、城六区、通州等地雨量将超过30毫米,城区防积水,山区灾区防地质灾害"
"北京暴雨受灾为何不见哭?"
"总理在哪里?原来在开会。温总:尽快推一批民间投资参与的重点项目"

最佳答案

查看完整内容

比如这样,找出暴雨和总理两个关键词 "\/\/@笑多了会变态:北京暴雨致使有人打不开车门造成溺亡,其实被困在车里逃生时" "收到北京暴雨提示短信:市气象台19时35分发布暴雨蓝色预警信号:未来3小时房山东部、大兴、城六区、通州等地雨量将超过30毫米,城区防积水,山区灾区防地质灾害" "北京暴雨受灾为何不见哭?" "总理在哪里?原来在开会。温总:尽快推一批民间投资参与的重点项目"
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 18:24:54 | 显示全部楼层    本楼为最佳答案   
昨非 发表于 2020-11-25 21:59
好吧,我回头先操作下试试,有什么问题再来请教,多谢了

比如这样,找出暴雨和总理两个关键词
  1. import re

  2. data = '''{"statuses":[{"created_at":"Mon Jul 30 23:59:28 +0800 2012","id":3473640819621095,"mid":"3473640819621095","idstr":"3473640819621095","text":"\/\/@\u7b11\u591a\u4e86\u4f1a\u53d8\u6001:\u5317\u4eac\u66b4\u96e8\u81f4\u4f7f\u6709\u4eba\u6253\u4e0d\u5f00\u8f66\u95e8\u9020\u6210\u6eba\u4ea1\uff0c\u5176\u5b9e\u88ab\u56f0\u5728\u8f66\u91cc\u9003\u751f\u65f6","source":"<a href="http:\/\/m.weibo.com\/web\/cellphone.php#iphone" rel="nofollow">iPhone\u5ba2\u6237\u7aef<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":2701566162,"idstr":"2701566162","screen_name":"\u51b0\u51b0DENG","name":"\u51b0\u51b0DENG","province":"35","city":"2","location":"\u798f\u5efa \u53a6\u95e8","description":"","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/2701566162\/50\/5645060822\/0","profile_url":"u\/2701566162","domain":"","weihao":"","gender":"f","followers_count":585,"friends_count":188,"statuses_count":2625,"favourites_count":299,"created_at":"Thu May 10 00:39:00 +0800 2012","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"allow_all_comment":false,"avatar_large":"http:\/\/tp3.sinaimg.cn\/2701566162\/180\/5645060822\/0","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":48,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"","id":3472139069968229,"mid":"3472139069968229","idstr":"3472139069968229","text":"\u62b1\u6b49\uff0c\u6b64\u5fae\u535a\u5df2\u88ab\u4f5c\u8005\u5220\u9664\u3002\u67e5\u770b\u5e2e\u52a9\uff1ahttp:\/\/t.cn\/zWSudZc","state":7,"deleted":"1"},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:57:36 +0800 2012","id":3473640337422006,"mid":"3473640337422006","idstr":"3473640337422006","text":"\u5a01\u5c3c\u65af\u5f53\u5730\u65f6\u95f49\u67083\u65e5\u665a7\u70b9\uff0c\u9614\u522b\u94f6\u5e55\u591a\u65f6\u7684\u5f20\u66fc\u7389\u5e26\u7740\u4e24\u90e8\u51fa\u6f14\u7684\u77ed\u7247\u56de\u5230\u805a\u5149\u706f\u524d\uff0c\u5728\u5176\u4e2d\u4e00\u90e8\u8bb2\u8ff0\u4e2d\u56fd\u975e\u6cd5\u79fb\u6c11\u5728\u82f1\u56fd\u6d77\u6ee9\u62fe\u8d1d\u9047\u96be\u4e8b\u4ef6\u7684\u77ed\u7247\u4e2d\uff0c\u5f20\u66fc\u7389\u66f4\u662f\u4ee5\u6beb\u65e0\u53f0\u8bcd\u7684\u798f\u5efa\u4e00\u5e26\u5973\u795e\u5988\u7956\u4e00\u89d2\u51fa\u955c\u3002","source":"<a href="http:\/\/itunes.apple.com\/cn\/app\/isinaweibo\/id375364700?mt=8" rel="nofollow">iPhone\u5fae\u535a\u52a9\u624b<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","thumbnail_pic":"http:\/\/ww1.sinaimg.cn\/thumbnail\/a53b39d6jw1dvfb6z6ktpj.jpg","bmiddle_pic":"http:\/\/ww1.sinaimg.cn\/bmiddle\/a53b39d6jw1dvfb6z6ktpj.jpg","original_pic":"http:\/\/ww1.sinaimg.cn\/large\/a53b39d6jw1dvfb6z6ktpj.jpg","geo":null,"user":{"id":2772122070,"idstr":"2772122070","screen_name":"lovecamin","name":"lovecamin","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/2772122070\/50\/5631795130\/1","profile_url":"u\/2772122070","domain":"","weihao":"","gender":"m","followers_count":68,"friends_count":515,"statuses_count":136,"favourites_count":0,"created_at":"Sat May 12 21:02:41 +0800 2012","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"allow_all_comment":true,"avatar_large":"http:\/\/tp3.sinaimg.cn\/2772122070\/180\/5631795130\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":9,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:57:32 +0800 2012","id":3473640320267576,"mid":"3473640320267576","idstr":"3473640320267576","text":"\u6536\u5230\u5317\u4eac\u66b4\u96e8\u63d0\u793a\u77ed\u4fe1\uff1a\u5e02\u6c14\u8c61\u53f019\u65f635\u5206\u53d1\u5e03\u66b4\u96e8\u84dd\u8272\u9884\u8b66\u4fe1\u53f7\uff1a\u672a\u67653\u5c0f\u65f6\u623f\u5c71\u4e1c\u90e8\u3001\u5927\u5174\u3001\u57ce\u516d\u533a\u3001\u901a\u5dde\u7b49\u5730\u96e8\u91cf\u5c06\u8d85\u8fc730\u6beb\u7c73\uff0c\u57ce\u533a\u9632\u79ef\u6c34\uff0c\u5c71\u533a\u707e\u533a\u9632\u5730\u8d28\u707e\u5bb3","source":"<a href="http:\/\/m.weibo.com\/web\/cellphone.php#iphone" rel="nofollow">iPhone\u5ba2\u6237\u7aef<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","thumbnail_pic":"http:\/\/ww2.sinaimg.cn\/thumbnail\/53789a0ajw1dvfb6vlhfmj.jpg","bmiddle_pic":"http:\/\/ww2.sinaimg.cn\/bmiddle\/53789a0ajw1dvfb6vlhfmj.jpg","original_pic":"http:\/\/ww2.sinaimg.cn\/large\/53789a0ajw1dvfb6vlhfmj.jpg","geo":null,"user":{"id":1400412682,"idstr":"1400412682","screen_name":"yangfan","name":"yangfan","province":"11","city":"8","location":"\u5317\u4eac \u6d77\u6dc0\u533a","description":"\u51ef\u91cc\u795e","url":"http:\/\/blog.sina.com.cn\/claudio","profile_image_url":"http:\/\/tp3.sinaimg.cn\/1400412682\/50\/1279878142\/1","profile_url":"claudio","domain":"claudio","weihao":"","gender":"m","followers_count":14502,"friends_count":1335,"statuses_count":3870,"favourites_count":21,"created_at":"Fri Aug 28 16:34:24 +0800 2009","following":false,"allow_all_act_msg":true,"geo_enabled":true,"verified":true,"verified_type":0,"allow_all_comment":true,"avatar_large":"http:\/\/tp3.sinaimg.cn\/1400412682\/180\/1279878142\/1","verified_reason":"\u65b0\u6d6a\u8fd0\u8425\u90e8\u5fae\u535a\u9891\u9053 \u6768\u5e06","follow_me":false,"online_status":0,"bi_followers_count":520,"lang":"zh-cn","star":0,"mbtype":12,"mbrank":2,"block_word":0,"ulevel":0},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:56:42 +0800 2012","id":3473640123459395,"mid":"3473640123459395","idstr":"3473640123459395","text":"\u5317\u4eac\u66b4\u96e8\u53d7\u707e\u4e3a\u4f55\u4e0d\u89c1\u54ed\uff1f","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":2430690160,"idstr":"2430690160","screen_name":"\u6211\u7cfb\u96f7\u4eba","name":"\u6211\u7cfb\u96f7\u4eba","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"","url":"","profile_image_url":"http:\/\/tp1.sinaimg.cn\/2430690160\/50\/5613491627\/1","profile_url":"u\/2430690160","domain":"","weihao":"","gender":"m","followers_count":58,"friends_count":185,"statuses_count":598,"favourites_count":301,"created_at":"Thu Sep 29 08:09:58 +0800 2011","following":false,"allow_all_act_msg":false,"geo_enabled":false,"verified":false,"verified_type":-1,"allow_all_comment":true,"avatar_large":"http:\/\/tp1.sinaimg.cn\/2430690160\/180\/5613491627\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":25,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"Mon Jul 30 23:10:12 +0800 2012","id":3473628421535818,"mid":"3473628421535818","idstr":"3473628421535818","text":"\u603b\u7406\u5728\u54ea\u91cc\uff1f\u539f\u6765\u5728\u5f00\u4f1a\u3002\u6e29\u603b\uff1a\u5c3d\u5feb\u63a8\u4e00\u6279\u6c11\u95f4\u6295\u8d44\u53c2\u4e0e\u7684\u91cd\u70b9\u9879\u76ee","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":1680497944,"idstr":"1680497944","screen_name":"\u53e4\u6587\u667a","name":"\u53e4\u6587\u667a","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"\u8d22\u7ecf\u4e3b\u6301\u3001\u8bb2\u5ea7\u7b56\u5212\u3001\u5584\u89c2\u5bdf\u5e76\u601d\u8003\uff0c\u7ea6\u7a3f\u3001\u7ea6\u8bb2\u5ea7\u8bf7\u79c1\u4fe1","url":"","profile_image_url":"http:\/\/tp1.sinaimg.cn\/1680497944\/50\/1279886572\/1","profile_url":"u\/1680497944","domain":"","weihao":"","gender":"m","followers_count":9178,"friends_count":437,"statuses_count":1100,"favourites_count":170,"created_at":"Mon Jan 11 12:23:22 +0800 2010","following":false,"allow_all_act_msg":true,"geo_enabled":true,"verified":true,"verified_type":0,"allow_all_comment":true,"avatar_large":"http:\/\/tp1.sinaimg.cn\/1680497944\/180\/1279886572\/1","verified_reason":"\u5e7f\u4e1c\u7535\u53f0\u80a1\u5e02\u53f0\u77e5\u540d\u8282\u76ee\u4e3b\u6301\u4eba \u53e4\u6587\u667a","follow_me":false,"online_status":0,"bi_followers_count":218,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"reposts_count":2,"comments_count":14,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:56:27 +0800 2012","id":3473640047943266,"mid":"3473640047943266","idstr":"3473640047943266","text":"[\u881f\u71ed]\/\/@\u7075\u6027\u4e4b\u74f6: [\u8721\u70db]\/\/@\u8463\u51c0\u5fc3: [\u8721\u70db]\/\/@\u5999\u97f3\u667a\u51ef: [\u8721\u70db]\/\/@\u6210\u5c31\u6df1\u4fe1: [\u8721\u70db][\u8721\u70db][\u8721\u70db] \/\/@\u6625\u83ef\u79cb\u5be6\u5fae\u8bed\u5f55: \u963f\u5f25\u9640\u4f5b\uff01[\u881f\u71ed]\u8ba9\u6211\u4eec\u5171\u540c\u7948\u7977\u5317\u4eac\u5929\u6d25[\u5fc3]\u53ca7.21\u9047\u96be\u4ea1\u7075\u5f97\u751f\u51c0\u571f\uff1b\u7948\u613f\u53d7\u707e\u7fa4\u4f17\u65e9\u65e5\u6062\u590d\u5f80\u65e5\u7684\u5bb6\u56ed\u3002 [\u881f\u71ed][\u881f\u71ed][\u881f\u71ed]\u613f\u751f\u8005\u5409\u7965\u5b89\u4e50 \u901d\u8005\u8131\u79bb\u82e6\u96be\uff01[\u881f\u71ed]","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":1966481342,"idstr":"1966481342","screen_name":"\u963f\u59c6\u601d","name":"\u963f\u59c6\u601d","province":"32","city":"5","location":"\u6c5f\u82cf \u82cf\u5dde","description":"\u6709\u5922\u6700\u7f8e,\u5e0c\u671b\u76f8\u96a8!","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/1966481342\/50\/5636031348\/1","profile_url":"u\/1966481342","domain":"","weihao":"","gender":"m","followers_count":1105,"friends_count":727,"statuses_count":3245,"favourites_count":117,"created_at":"Tue Mar 01 00:01:33 +0800 2011","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":220,"allow_all_comment":false,"avatar_large":"http:\/\/tp3.sinaimg.cn\/1966481342\/180\/5636031348\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":716,"lang":"zh-tw","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"Fri Jul 27 18:50:32 +0800 2012","id":3472475897393643,"mid":"3472475897393643","idstr":"3472475897393643",'''
  3. result=re.findall('"text":(.*?),', data)
  4. print(result)
  5. print()
  6. for a in result:
  7.     t=re.search(r'暴雨|总理', a)
  8.     if t !=None:
  9.         print(a)
复制代码

"\/\/@笑多了会变态:北京暴雨致使有人打不开车门造成溺亡,其实被困在车里逃生时"
"收到北京暴雨提示短信:市气象台19时35分发布暴雨蓝色预警信号:未来3小时房山东部、大兴、城六区、通州等地雨量将超过30毫米,城区防积水,山区灾区防地质灾害"
"北京暴雨受灾为何不见哭?"
"总理在哪里?原来在开会。温总:尽快推一批民间投资参与的重点项目"

评分

参与人数 1贡献 +3 收起 理由
昨非 + 3

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 18:28:11 | 显示全部楼层
@小甲鱼 @冬雪雪冬 @疾风怪盗 @zltzlt @Twilight6 @不二如是
实在抱歉打扰诸位,生活所迫
小弟也很无奈啊
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 18:30:42 | 显示全部楼层
老卑微了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 18:42:00 | 显示全部楼层
本帖最后由 suchocolate 于 2020-11-25 18:57 编辑

python: json
  1. #1)临时输入:json数据需要用双引号表示
  2. #--------------------------------------------------------------------------------
  3. import json
  4. str = '''
  5. { "name": "Bob", "date": "20200420", "ls": [{"k1": "v1", "k2": "v2"}, {"d1": "d1", "d2": "d2"}]}
  6. '''
  7. print("原始数据类型: ", type(str))
  8. data = json.loads(str)
  9. print("json转换后: ", type(data))
  10. print("全部数据: ", data)
  11. print("name: ", data["name"])
  12. print("ls: ", data["ls"][0]["k2"])
  13. #--------------------------------------------------------------------------------
  14. #2)文件输入:
  15. with open('data.json','r') as f:
  16.     str = f.read()
  17.     data = json.loads(str)
  18.     print(data)
  19.     print(data["name"])
  20. #--------------------------------------------------------------------------------
  21. #3)输出文件:
  22. data = {"test": "v1"}
  23. with open('data.json', 'w') as f:
  24.     f.write(json.dumps(data, indent=2, ensure_ascii=False))
  25. --------------------------------------------------------------------------------
复制代码

linux shell : jq test.json
web在线: http://www.bejson.com/jsonviewernew/

评分

参与人数 1荣誉 +5 鱼币 +5 贡献 +3 收起 理由
昨非 + 5 + 5 + 3 谢了

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 18:53:41 | 显示全部楼层
suchocolate 发表于 2020-11-25 18:42
python: json
linux shell : jq test.json
web在线: http://www.bejson.com/jsonviewernew/

感谢回复,这个在线工具挺好,
不过这个最佳可能要拖一段时间再设
我需要更多信息

评分

参与人数 1荣誉 +5 贡献 +3 收起 理由
严凯 + 5 + 3

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 18:56:09 | 显示全部楼层
昨非 发表于 2020-11-25 18:53
感谢回复,这个在线工具挺好,
不过这个最佳可能要拖一段时间再设
我需要更多信息

没事。
你的项目具体需求是啥,上面的json括号没成对。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 18:58:30 | 显示全部楼层
suchocolate 发表于 2020-11-25 18:56
没事。
你的项目具体需求是啥,上面的json括号没成对。

太大了发不全,不然刷屏了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 19:06:51 | 显示全部楼层
suchocolate 发表于 2020-11-25 18:56
没事。
你的项目具体需求是啥,上面的json括号没成对。

要求对舆情分析,可能需要截取出text部分
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 20:07:10 From FishC Mobile | 显示全部楼层
昨非 发表于 2020-11-25 19:06
要求对舆情分析,可能需要截取出text部分

json和字典等同
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 20:10:12 | 显示全部楼层


这个我倒是了解,
不过想了解下习惯上 text数据如何取出
取出来后如何存储,如何处理 等
毕竟1个G,总不会要傻瓜式遍历出来吧(不太清楚,见谅
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 20:19:03 From FishC Mobile | 显示全部楼层
昨非 发表于 2020-11-25 20:10
这个我倒是了解,
不过想了解下习惯上 text数据如何取出
取出来后如何存储,如何处理 等

一个g的网络接口数据还真没玩过
不过json不遍历,咋取数据??

评分

参与人数 1荣誉 +5 鱼币 +5 贡献 +3 收起 理由
昨非 + 5 + 5 + 3 最佳可能要拖些时间,总之谢谢回复啦

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 20:21:58 | 显示全部楼层
wp231957 发表于 2020-11-25 20:19
一个g的网络接口数据还真没玩过
不过json不遍历,咋取数据??

我也不太清楚,不过听说有些现有算法啥的可以简化
我也是第一次处理数据,全没经验
我好像也就只会小甲鱼课内哪点儿字典的经验
挑战挺大的
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 20:39:45 From FishC Mobile | 显示全部楼层
昨非 发表于 2020-11-25 20:21
我也不太清楚,不过听说有些现有算法啥的可以简化
我也是第一次处理数据,全没经验
我好像也就只会小甲 ...

我仅仅好奇,这一克的数据你是如何请求下来的呢
这么大的数据包,只有支持断点的下载软件才能请求下来,py的话应该请求不来
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 20:44:19 | 显示全部楼层
wp231957 发表于 2020-11-25 20:39
我仅仅好奇,这一克的数据你是如何请求下来的呢
这么大的数据包,只有支持断点的下载软件才能请求下来, ...


这是队有搞到的数据,好像是老师那儿搞到的

现在微博后台数据据说超级难爬
这数据集也好多年了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 20:46:46 From FishC Mobile | 显示全部楼层
昨非 发表于 2020-11-25 20:44
这是队有搞到的数据,好像是老师那儿搞到的

现在微博后台数据据说超级难爬

哦,你貌似在弄什么数学建模
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 20:50:41 | 显示全部楼层
wp231957 发表于 2020-11-25 20:46
哦,你貌似在弄什么数学建模

???何出此言,?
课程名字叫《社交网络分析》,有一说一,没点儿基础挑战挺大的
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 21:37:26 | 显示全部楼层
json格式很简单,4楼回答的就很全了,我一般都爬下来后先保存了,再用pycharm打开,格式化一下,就可以看到数据结构了
你给的部分数据,格式不对,也没法看
要取出数据,也很简单,就像字典一样一层一层取的,一般都这种数据,找到个类似列表的结构,循环,再取出对应的数据

其实你给的片段,就算格式不对,不用json么,用正则也可以取出数据啊,因为key都是固定的吧,
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-11-25 21:40:11 | 显示全部楼层
疾风怪盗 发表于 2020-11-25 21:37
json格式很简单,4楼回答的就很全了,我一般都爬下来后先保存了,再用pycharm打开,格式化一下,就可以看到 ...

确实不全,整个json太大了,粘不上来
正则表达式我没学过,就很难,而且数据量巨多
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-11-25 21:43:35 | 显示全部楼层
昨非 发表于 2020-11-25 21:40
确实不全,整个json太大了,粘不上来
正则表达式我没学过,就很难,而且数据量巨多
  1. import re
  2. data='''{"statuses":[{"created_at":"Mon Jul 30 23:59:28 +0800 2012","id":3473640819621095,"mid":"3473640819621095","idstr":"3473640819621095","text":"\/\/@\u7b11\u591a\u4e86\u4f1a\u53d8\u6001:\u5317\u4eac\u66b4\u96e8\u81f4\u4f7f\u6709\u4eba\u6253\u4e0d\u5f00\u8f66\u95e8\u9020\u6210\u6eba\u4ea1\uff0c\u5176\u5b9e\u88ab\u56f0\u5728\u8f66\u91cc\u9003\u751f\u65f6","source":"<a href="http:\/\/m.weibo.com\/web\/cellphone.php#iphone" rel="nofollow">iPhone\u5ba2\u6237\u7aef<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":2701566162,"idstr":"2701566162","screen_name":"\u51b0\u51b0DENG","name":"\u51b0\u51b0DENG","province":"35","city":"2","location":"\u798f\u5efa \u53a6\u95e8","description":"","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/2701566162\/50\/5645060822\/0","profile_url":"u\/2701566162","domain":"","weihao":"","gender":"f","followers_count":585,"friends_count":188,"statuses_count":2625,"favourites_count":299,"created_at":"Thu May 10 00:39:00 +0800 2012","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"allow_all_comment":false,"avatar_large":"http:\/\/tp3.sinaimg.cn\/2701566162\/180\/5645060822\/0","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":48,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"","id":3472139069968229,"mid":"3472139069968229","idstr":"3472139069968229","text":"\u62b1\u6b49\uff0c\u6b64\u5fae\u535a\u5df2\u88ab\u4f5c\u8005\u5220\u9664\u3002\u67e5\u770b\u5e2e\u52a9\uff1ahttp:\/\/t.cn\/zWSudZc","state":7,"deleted":"1"},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:57:36 +0800 2012","id":3473640337422006,"mid":"3473640337422006","idstr":"3473640337422006","text":"\u5a01\u5c3c\u65af\u5f53\u5730\u65f6\u95f49\u67083\u65e5\u665a7\u70b9\uff0c\u9614\u522b\u94f6\u5e55\u591a\u65f6\u7684\u5f20\u66fc\u7389\u5e26\u7740\u4e24\u90e8\u51fa\u6f14\u7684\u77ed\u7247\u56de\u5230\u805a\u5149\u706f\u524d\uff0c\u5728\u5176\u4e2d\u4e00\u90e8\u8bb2\u8ff0\u4e2d\u56fd\u975e\u6cd5\u79fb\u6c11\u5728\u82f1\u56fd\u6d77\u6ee9\u62fe\u8d1d\u9047\u96be\u4e8b\u4ef6\u7684\u77ed\u7247\u4e2d\uff0c\u5f20\u66fc\u7389\u66f4\u662f\u4ee5\u6beb\u65e0\u53f0\u8bcd\u7684\u798f\u5efa\u4e00\u5e26\u5973\u795e\u5988\u7956\u4e00\u89d2\u51fa\u955c\u3002","source":"<a href="http:\/\/itunes.apple.com\/cn\/app\/isinaweibo\/id375364700?mt=8" rel="nofollow">iPhone\u5fae\u535a\u52a9\u624b<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","thumbnail_pic":"http:\/\/ww1.sinaimg.cn\/thumbnail\/a53b39d6jw1dvfb6z6ktpj.jpg","bmiddle_pic":"http:\/\/ww1.sinaimg.cn\/bmiddle\/a53b39d6jw1dvfb6z6ktpj.jpg","original_pic":"http:\/\/ww1.sinaimg.cn\/large\/a53b39d6jw1dvfb6z6ktpj.jpg","geo":null,"user":{"id":2772122070,"idstr":"2772122070","screen_name":"lovecamin","name":"lovecamin","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/2772122070\/50\/5631795130\/1","profile_url":"u\/2772122070","domain":"","weihao":"","gender":"m","followers_count":68,"friends_count":515,"statuses_count":136,"favourites_count":0,"created_at":"Sat May 12 21:02:41 +0800 2012","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"allow_all_comment":true,"avatar_large":"http:\/\/tp3.sinaimg.cn\/2772122070\/180\/5631795130\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":9,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:57:32 +0800 2012","id":3473640320267576,"mid":"3473640320267576","idstr":"3473640320267576","text":"\u6536\u5230\u5317\u4eac\u66b4\u96e8\u63d0\u793a\u77ed\u4fe1\uff1a\u5e02\u6c14\u8c61\u53f019\u65f635\u5206\u53d1\u5e03\u66b4\u96e8\u84dd\u8272\u9884\u8b66\u4fe1\u53f7\uff1a\u672a\u67653\u5c0f\u65f6\u623f\u5c71\u4e1c\u90e8\u3001\u5927\u5174\u3001\u57ce\u516d\u533a\u3001\u901a\u5dde\u7b49\u5730\u96e8\u91cf\u5c06\u8d85\u8fc730\u6beb\u7c73\uff0c\u57ce\u533a\u9632\u79ef\u6c34\uff0c\u5c71\u533a\u707e\u533a\u9632\u5730\u8d28\u707e\u5bb3","source":"<a href="http:\/\/m.weibo.com\/web\/cellphone.php#iphone" rel="nofollow">iPhone\u5ba2\u6237\u7aef<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","thumbnail_pic":"http:\/\/ww2.sinaimg.cn\/thumbnail\/53789a0ajw1dvfb6vlhfmj.jpg","bmiddle_pic":"http:\/\/ww2.sinaimg.cn\/bmiddle\/53789a0ajw1dvfb6vlhfmj.jpg","original_pic":"http:\/\/ww2.sinaimg.cn\/large\/53789a0ajw1dvfb6vlhfmj.jpg","geo":null,"user":{"id":1400412682,"idstr":"1400412682","screen_name":"yangfan","name":"yangfan","province":"11","city":"8","location":"\u5317\u4eac \u6d77\u6dc0\u533a","description":"\u51ef\u91cc\u795e","url":"http:\/\/blog.sina.com.cn\/claudio","profile_image_url":"http:\/\/tp3.sinaimg.cn\/1400412682\/50\/1279878142\/1","profile_url":"claudio","domain":"claudio","weihao":"","gender":"m","followers_count":14502,"friends_count":1335,"statuses_count":3870,"favourites_count":21,"created_at":"Fri Aug 28 16:34:24 +0800 2009","following":false,"allow_all_act_msg":true,"geo_enabled":true,"verified":true,"verified_type":0,"allow_all_comment":true,"avatar_large":"http:\/\/tp3.sinaimg.cn\/1400412682\/180\/1279878142\/1","verified_reason":"\u65b0\u6d6a\u8fd0\u8425\u90e8\u5fae\u535a\u9891\u9053 \u6768\u5e06","follow_me":false,"online_status":0,"bi_followers_count":520,"lang":"zh-cn","star":0,"mbtype":12,"mbrank":2,"block_word":0,"ulevel":0},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:56:42 +0800 2012","id":3473640123459395,"mid":"3473640123459395","idstr":"3473640123459395","text":"\u5317\u4eac\u66b4\u96e8\u53d7\u707e\u4e3a\u4f55\u4e0d\u89c1\u54ed\uff1f","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":2430690160,"idstr":"2430690160","screen_name":"\u6211\u7cfb\u96f7\u4eba","name":"\u6211\u7cfb\u96f7\u4eba","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"","url":"","profile_image_url":"http:\/\/tp1.sinaimg.cn\/2430690160\/50\/5613491627\/1","profile_url":"u\/2430690160","domain":"","weihao":"","gender":"m","followers_count":58,"friends_count":185,"statuses_count":598,"favourites_count":301,"created_at":"Thu Sep 29 08:09:58 +0800 2011","following":false,"allow_all_act_msg":false,"geo_enabled":false,"verified":false,"verified_type":-1,"allow_all_comment":true,"avatar_large":"http:\/\/tp1.sinaimg.cn\/2430690160\/180\/5613491627\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":25,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"Mon Jul 30 23:10:12 +0800 2012","id":3473628421535818,"mid":"3473628421535818","idstr":"3473628421535818","text":"\u603b\u7406\u5728\u54ea\u91cc\uff1f\u539f\u6765\u5728\u5f00\u4f1a\u3002\u6e29\u603b\uff1a\u5c3d\u5feb\u63a8\u4e00\u6279\u6c11\u95f4\u6295\u8d44\u53c2\u4e0e\u7684\u91cd\u70b9\u9879\u76ee","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":1680497944,"idstr":"1680497944","screen_name":"\u53e4\u6587\u667a","name":"\u53e4\u6587\u667a","province":"44","city":"1","location":"\u5e7f\u4e1c \u5e7f\u5dde","description":"\u8d22\u7ecf\u4e3b\u6301\u3001\u8bb2\u5ea7\u7b56\u5212\u3001\u5584\u89c2\u5bdf\u5e76\u601d\u8003\uff0c\u7ea6\u7a3f\u3001\u7ea6\u8bb2\u5ea7\u8bf7\u79c1\u4fe1","url":"","profile_image_url":"http:\/\/tp1.sinaimg.cn\/1680497944\/50\/1279886572\/1","profile_url":"u\/1680497944","domain":"","weihao":"","gender":"m","followers_count":9178,"friends_count":437,"statuses_count":1100,"favourites_count":170,"created_at":"Mon Jan 11 12:23:22 +0800 2010","following":false,"allow_all_act_msg":true,"geo_enabled":true,"verified":true,"verified_type":0,"allow_all_comment":true,"avatar_large":"http:\/\/tp1.sinaimg.cn\/1680497944\/180\/1279886572\/1","verified_reason":"\u5e7f\u4e1c\u7535\u53f0\u80a1\u5e02\u53f0\u77e5\u540d\u8282\u76ee\u4e3b\u6301\u4eba \u53e4\u6587\u667a","follow_me":false,"online_status":0,"bi_followers_count":218,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"reposts_count":2,"comments_count":14,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},"reposts_count":0,"comments_count":0,"attitudes_count":0,"mlevel":0,"visible":{"type":0,"list_id":0}},{"created_at":"Mon Jul 30 23:56:27 +0800 2012","id":3473640047943266,"mid":"3473640047943266","idstr":"3473640047943266","text":"[\u881f\u71ed]\/\/@\u7075\u6027\u4e4b\u74f6: [\u8721\u70db]\/\/@\u8463\u51c0\u5fc3: [\u8721\u70db]\/\/@\u5999\u97f3\u667a\u51ef: [\u8721\u70db]\/\/@\u6210\u5c31\u6df1\u4fe1: [\u8721\u70db][\u8721\u70db][\u8721\u70db] \/\/@\u6625\u83ef\u79cb\u5be6\u5fae\u8bed\u5f55: \u963f\u5f25\u9640\u4f5b\uff01[\u881f\u71ed]\u8ba9\u6211\u4eec\u5171\u540c\u7948\u7977\u5317\u4eac\u5929\u6d25[\u5fc3]\u53ca7.21\u9047\u96be\u4ea1\u7075\u5f97\u751f\u51c0\u571f\uff1b\u7948\u613f\u53d7\u707e\u7fa4\u4f17\u65e9\u65e5\u6062\u590d\u5f80\u65e5\u7684\u5bb6\u56ed\u3002 [\u881f\u71ed][\u881f\u71ed][\u881f\u71ed]\u613f\u751f\u8005\u5409\u7965\u5b89\u4e50 \u901d\u8005\u8131\u79bb\u82e6\u96be\uff01[\u881f\u71ed]","source":"<a href="http:\/\/weibo.com\/" rel="nofollow">\u65b0\u6d6a\u5fae\u535a<\/a>","favorited":false,"truncated":false,"in_reply_to_status_id":"","in_reply_to_user_id":"","in_reply_to_screen_name":"","geo":null,"user":{"id":1966481342,"idstr":"1966481342","screen_name":"\u963f\u59c6\u601d","name":"\u963f\u59c6\u601d","province":"32","city":"5","location":"\u6c5f\u82cf \u82cf\u5dde","description":"\u6709\u5922\u6700\u7f8e,\u5e0c\u671b\u76f8\u96a8!","url":"","profile_image_url":"http:\/\/tp3.sinaimg.cn\/1966481342\/50\/5636031348\/1","profile_url":"u\/1966481342","domain":"","weihao":"","gender":"m","followers_count":1105,"friends_count":727,"statuses_count":3245,"favourites_count":117,"created_at":"Tue Mar 01 00:01:33 +0800 2011","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":220,"allow_all_comment":false,"avatar_large":"http:\/\/tp3.sinaimg.cn\/1966481342\/180\/5636031348\/1","verified_reason":"","follow_me":false,"online_status":0,"bi_followers_count":716,"lang":"zh-tw","star":0,"mbtype":0,"mbrank":0,"block_word":0,"ulevel":0},"retweeted_status":{"created_at":"Fri Jul 27 18:50:32 +0800 2012","id":3472475897393643,"mid":"3472475897393643","idstr":"3472475897393643",'''
  3. print(re.findall('"id":(.*?),',data))
  4. print(re.findall('"text":(.*?),',data))
  5. print(re.findall('"source":(.*?),',data))
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-20 16:45

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表