def cursor_to_dict(f1, retrieve):
results = []
for f in f1:
results.append(f)
ret = []
for a in results:
dic = {}
for key in retrieve.keys():
steps = key.split('.')
partial_res = a
for step in steps:
partial_res = partial_res.get(step)
if partial_res is None:
break
if isinstance(partial_res, list):
partial_res = None
break
legend_to_show = key.split('.')[-1]
if (legend_to_show == "file_id"):
legend_to_show = "sha1"
if (legend_to_show == "TimeDateStamp" and partial_res is not None):
partial_res = time.strftime(
"%Y-%m-%d %H:%M:%S", time.gmtime(int(eval(partial_res), 16)))
if (legend_to_show == "timeDateStamp" and partial_res is not None):
partial_res = time.strftime(
"%Y-%m-%d %H:%M:%S", time.gmtime(partial_res))
dic[legend_to_show] = partial_res
ret.append(dic)
return ret
# ****************TEST_CODE******************
评论列表
文章目录