#!/usr/bin/env python
# coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import json
import requests
from chardet import detect
false = False
null = ""
true = True
#from werobot import client
file_path = 'data1.json'
with open(file_path) as f:
js = f.read()
dic = eval(js)
def ana(month):
i = len(dic["items"])-1
st = ""
while i > 0:
#print dic["items"][i]["name"]
if st.find(dic["items"][i]["name"]) == -1:
#print st.find(dic["items"][194]["name"])
st = st + dic["items"][i]["properties"]["lastModifiedDate"][0:4].replace("/",".")+" " + dic["items"][i]["name"] +str(i)+"\n"
i = i - 1
i = i - 1
return st
all_data = ana("7")
print all_data
st.find(dic [“ items”] [194] [“ name”])= -1
但它不能通过if条件:
st.find(dic [“ items”] [i] [“ name”])== -1
data1.json在要点上:data1.json在要点上
该代码有什么问题吗?
慕莱坞森
相关分类