【发布时间】:2019-10-28 09:26:12
【问题描述】:
如何迭代此代码,以便动态保存列表中上次交易的值?
def get_ltp(data, strike_price):
for d in data:
if strike_price == d[5]:
return d[5]
n=get_ltp(data, '12000.00')
n2=int(n.replace(',', ''))
vol_opt.append(n2)
print(vol_opt)
threading.Timer(5, get_ltp(data,'12000.00')).start()
get_ltp(data, '12000.00')
【问题讨论】:
-
请正确格式化代码。
-
@ Tech Nerd 代码现在采用所需格式。
-
你想让代码做什么?它有什么作用?
-
代码应该每5秒迭代一次,vol_opt是一个列表,其中包含'last price'的值,每5秒代码应该提供列表中的元素。
-
那么代码基本上应该每5秒运行一次?
标签: python json beautifulsoup