import json
u='''{
"maps": [
{
"id": "blabla",
"iscategorical": "0"
},
{
"id": "blabla",
"iscategorical": "0"
}
],
"masks": {
"id": "valore"
},
"om_points": "value",
"parameters": {
"id": "valore"
}
}
'''
#s=u.encode('utf-8');
#with open('test.json','wb') as f:
# f.write(s);
from pprint import pprint
with open('test.json',"rb") as f:
b=f.read()
data = json.loads(b)
pprint(data)
print(data["maps"][0]["id"])
print(data["masks"]["id"])
print(data["om_points"])
#with open('test.json',"rb") as f:
# data = json.load(f)
#pprint(data)
events=["eat","drink","sleep"];
s="###".join("{event}_{i}".format(i=i,event=event) for i, event in enumerate(events));
print(s)
f=''
g=None
if f:
print("xixi")
else:
print("haha")
if g:
print("hehe")
else:
print("lala")

posted on 2018-12-07 15:55  finallyly  阅读(188)  评论(0编辑  收藏  举报