Commit 576b6aa7 authored by 王志伟's avatar 王志伟

add write to file

parent 41328a9b
...@@ -49,6 +49,14 @@ def ctr(date): ...@@ -49,6 +49,14 @@ def ctr(date):
if exp != 0: if exp != 0:
print("点击率:"+str(click/exp)) print("点击率:"+str(click/exp))
return click,exp,click/exp
def rate2file():
output_path = DIRECTORY_PATH + "rate.csv"
with open(output_path,'a+') as f:
line = get_yesterday_date().replace('-', '')+','+str(ctr(date)[0])+','+str(ctr(date)[1])+','+str(ctr(date)[2])+'\n'
f.write(line)
if __name__ == "__main__": if __name__ == "__main__":
date = get_yesterday_date() date = get_yesterday_date()
ctr(date) ctr(date)
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