以下是我的代码:
R = requests.get("https://api.website.com/v1/....")
data = R.json()
for x in data:
ticker = x['symbol']
cost = x['price_usd']
print (ticker + "\t:" + cost)
with open('Marketcap.txt', 'w') as outfile:
json.dump(data, outfile, indent=2)
time.sleep(3600)
R2 = requests.get("https://api.website.com/v1/....")
data2 = R2.json()
for y in data2:
ticker2 = y['symbol']
cost2 = y['price_usd']
print(ticker2 +":\t" + cost2)
with open('Marketcap2.txt', 'w') as outfile2:
json.dump(data2, outfile2, indent=2)
time.sleep(3600)
然而,单元格B1保持显示日期1/7/1900。任何人都可以告诉我应该如何纠正它?
非常感谢!
答案 0 :(得分:1)
我认为不允许函数修改单元格值。函数只应返回一个值,该值将设置从中调用的单元格的值。
如果你想修改单元格值,那么你应该看一下使用Sub。
BTW,您的函数不使用Format参数。