【发布时间】:2020-03-05 00:16:26
【问题描述】:
我想在 localhost 上打印 't' 和 's'。但它不适用于定时器功能。这是我尝试过的。
import requests
import pandas as pd
import time
from bottle import route, run
def timer(n):
while True:
url2 = 'https://api.bittrex.com/api/v1.1/public/getticker?market=USDT-BTC'
res = requests.get(url2).json()
BTC = pd.json_normalize(res['result'])
t = time.ctime()
s = BTC.to_html(index=False)
time.sleep(n)
timer(5)
@route('/')
def index():
return t, s
run(host='localhost', port=8080)
【问题讨论】:
-
def timer(n)
-
你能比“它不起作用”更具体吗?