Commit a99efd7d authored by 高雅喆's avatar 高雅喆

update output format

parent c8a1b61c
......@@ -78,7 +78,7 @@ def get_click_zero_uid_rate_detail(platform):
dct2 = get_register_uid_count()
result = {}
for k in dct1:
result[k] = dct1[k]/dct2[k]
result[k] = round(dct1[k]/dct2[k],4)
return result
......
......@@ -168,11 +168,16 @@ def result2file():
f.write(line)
f.write('\n')
f.write("#1.8无点击用户数分布(=无点击用户∩激活用户 / 激活用户数) #注意:(]里面的数字指的是距离当前时间的天数\n")
f.write("平台"+'\t'+"0-7"+'\t'+"7-14"+'\t'+ \
"14-30"+'\t'+"30-60"+'\t'+"60-90"+'\t'+"90+"+'\n')
f.write("平台"+'\t\t'+"0-7"+'\t\t'+"7-14"+'\t\t'+ \
"14-30"+'\t\t'+"30-60"+'\t\t'+"60-90"+'\t\t'+"90+"+'\n')
for i in click_zero_uid_detail_result:
f.write(i["platform"]+'\t'+str(i["0-7"])+'\t'+str(i["7-14"])+'\t'+str(i["14-30"])+ \
'\t'+str(i["30-60"])+'\t'+str(i["60-90"])+'\t'+str(i["90+"])+'\n')
f.write(i["platform"]+'\t\t'+\
"{}%".format(round(i["0-7"]*100,2))+'\t\t'+\
"{}%".format(round(i["7-14"]*100,2))+'\t\t'+\
"{}%".format(round(i["14-30"]*100,2))+'\t\t'+\
"{}%".format(round(i["30-60"]*100,2))+'\t\t'+\
"{}%".format(round(i["60-90"]*100,2))+'\t\t'+\
"{}%".format(round(i["90+"]*100,2))+'\n')
f.write('\n\n\n')
#==========================================================================================
tplt = "{0:^10}\t{1:^10}\n"
......@@ -192,7 +197,7 @@ def result2file():
f.write(header)
for i in top_diary_result:
for j in i:
f.write(tplt.format(j[0],j[1],j[2],j[3],j[4],j[5]))
f.write(tplt.format(j[0],j[1],j[2],j[3],"{}%".format(round(j[4]*100,2)),j[5]))
f.write(sep)
if i != top_diary_result[-1]:
f.write(header)
......@@ -204,7 +209,7 @@ def result2file():
f.write(header)
for i in top_answer_result:
for j in i:
f.write(tplt.format(j[0],j[1],j[2],j[3],j[4],j[5]))
f.write(tplt.format(j[0],j[1],j[2],j[3],"{}%".format(round(j[4]*100,2)),j[5]))
f.write(sep)
if i != top_answer_result[-1]:
f.write(header)
......@@ -216,7 +221,7 @@ def result2file():
f.write(header)
for i in top_question_result:
for j in i:
f.write(tplt.format(j[0],j[1],j[2],j[3],j[4],j[5]))
f.write(tplt.format(j[0],j[1],j[2],j[3],"{}%".format(round(j[4]*100,2)),j[5]))
f.write(sep)
if i != top_question_result[-1]:
f.write(header)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment