Python中文
首页
教程
问答
标签
搜索
登录
注册
用python搜索JSON响应
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我找了又找,但还是搞不清楚。下面是我从web服务API中获取的JSON数据:</p> <pre><code>{ "total_count": 673, "items": [ { "hap": "delivered", "message": "Delivered: no-reply@example.com \u2192 jon.doe@gmail.com 'Some Email subject'", "type": "info", "created_at": "Wed, 19 Aug 2015 18:38:54 GMT", "message_id": "20150819183853.13720.31771@example.com" }, { "hap": "accepted", "message": "Accepted: no-reply@example.com \u2192 jon.doe@gmail.com 'Subject of this email here'", "type": "info", "created_at": "Wed, 19 Aug 2015 18:38:53 GMT", "message_id": "20150819183853.13720.31771@example.com" }, { "hap": "delivered", "message": "Delivered: no-reply@example.com \u2192 jane.doe@gmail.com 'Subject Line here'", "type": "info", "created_at": "Wed, 19 Aug 2015 18:37:50 GMT", "message_id": "20150819183749.13738.20180@example.com" }, </code></pre> <p>挑战是我试图在“message”:块中搜索“message”:位置中“\u2192”后面的to email地址。在</p> <p>我创建了一个python脚本,它将“message”中的所有条目转储起来:但是我无法用特定的电子邮件地址来过滤它。在</p> ^{pr2}$
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>尝试:</p> <pre><code>re.findall("[^@ ]+@[^@]+\.[^@ ]+", data['message'].split("\u2192")[1])[0] </code></pre> <p>首先,我用字符<code>\u2192</code>将<code>data['message']</code>分成两部分,然后进行第二部分。我试着在第二部分找到所有的电子邮件,只选择第一部分,因为这是你要找的。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
尝试加密和解密文本文件(Python)
8 回答
尝试加密文本文件会导致类型错误
9 回答
尝试加密时溢出错误
2 回答
尝试加载.plist文件时出现“无此类文件或目录”错误
6 回答
尝试加载“blog.templatetags.blog_标记”时引发ImportError:没有名为“markdown”的模块
5 回答
尝试加载“menus.templatetags.menus\u标记”时引发ImportError:无法从“menus.models”导入名称“menus”
4 回答
尝试加载5GB文本fi时发生Python内存错误
1 回答
尝试加载5GB文本文件时出现MemoryError
2 回答
尝试加载Django模板时出现渲染错误
4 回答
尝试加载exi时出错
10 回答
尝试加载imag时使用精灵表失败
5 回答
尝试加载json.Python时出错
7 回答
尝试加载json文件时遇到此错误:json.decoder.jsondeCoderror:预期值:第1行第1列(char 0)
4 回答
尝试加载keras和tensorflow,我仍然得到ModuleNotFoundError:在我的Anaconda环境中没有名为'tensorflow_core.estimator'的模块
9 回答
尝试加载Librosa的示例fi时出现“找不到文件”错误
10 回答
尝试加载matplotlib时发生iPython笔记本错误
8 回答
尝试加载MP3时出现PyGame错误
3 回答
尝试加载pickled matplotlib figu时发生AttributeError
5 回答
尝试加载pickle文件时出错
9 回答
尝试加载Pytoch模型时遇到问题:“在模块中找不到标识”
6 回答