python字典按绝对值排序

  sre

-223bfb5bc6f8969e.jpg

# python字典按绝对值排序
elf.buy_orders.sort(key=lambda x: abs(float(x['price'])-float(avg_price_5min)), reverse=True)  

LEAVE A COMMENT

Captcha Code