由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - how to parse json to csv , using python?
相关主题
求讨论一道SYSTEM DESIGN题,CC10.1有没有可能爬虫(crawl)wechat?
请教一个C++的题目Google Intern Host Matching求收留推荐
Front-End Developer @ Verizon Wireless NJGoogle intern host match求收留
Job Opening @ Verizon Wireless @ Central NJ谷歌实习host match求捞
Dev Position at Verizon Wireless in Central NJG company intern host match
新鲜,可以通过HTTP POST发送你的简历准备不好面试就是会悲剧
现在写android 有什么好用的framework么?G家这是进入host match了吗?
下面这道uber电面,怎么做?收到G家邮件,不太明白这是什么意思
相关话题的讨论汇总
话题: csv话题: host话题: json话题: python话题: parse
进入JobHunting版参与讨论
1 (共1页)
u***8
发帖数: 1581
1
json is already :
{ "mem": [
{
"id":"v1",
"money":"v2",
"host":"v3"
}
}
I only need "id" and "host" to form a csv like this
id, host
"v1","v2"
"v3","v4"
like so. Can someone help me out? I am so water in python. wasted 3 hours!
w****k
发帖数: 6244
2
import csv
with open('out.csv', 'wb') as f:
writer = csv.writer(f, delimiter=',',quotechar='"',quoting=csv.QUOTE_
ALL)
for item in dic.get("mem"):
writer.writerow([item.get('id'), item.get('host')])


【在 u***8 的大作中提到】
: json is already :
: { "mem": [
: {
: "id":"v1",
: "money":"v2",
: "host":"v3"
: }
: }
: I only need "id" and "host" to form a csv like this
: id, host

u***8
发帖数: 1581
3
r u sure it works ?thanks!

【在 w****k 的大作中提到】
: import csv
: with open('out.csv', 'wb') as f:
: writer = csv.writer(f, delimiter=',',quotechar='"',quoting=csv.QUOTE_
: ALL)
: for item in dic.get("mem"):
: writer.writerow([item.get('id'), item.get('host')])
:

u***8
发帖数: 1581
4
up up up up up
1 (共1页)
进入JobHunting版参与讨论
相关主题
收到G家邮件,不太明白这是什么意思Dev Position at Verizon Wireless in Central NJ
Google Offer,发100个包子,感谢待字闺中版新鲜,可以通过HTTP POST发送你的简历
一个很全SAS Interview Q. List [ZT]现在写android 有什么好用的framework么?
print a BST level by level, last row first下面这道uber电面,怎么做?
求讨论一道SYSTEM DESIGN题,CC10.1有没有可能爬虫(crawl)wechat?
请教一个C++的题目Google Intern Host Matching求收留推荐
Front-End Developer @ Verizon Wireless NJGoogle intern host match求收留
Job Opening @ Verizon Wireless @ Central NJ谷歌实习host match求捞
相关话题的讨论汇总
话题: csv话题: host话题: json话题: python话题: parse