unknown
2022-08-18 bc6204f30deb7518b6f4738e3c842598cd040545
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import decimal
import random
import time as t
import datetime
 
 
def get_expire():
    now = int(t.time())
    end = int(t.time()) + 60 * 60 * 24
    local_time = t.strftime("%Y-%m-%d", t.localtime(end))
    end = int(t.mktime(t.strptime(local_time, "%Y-%m-%d")))
    expire = end - now
    # 加随机数,防止一起销毁数据
    expire += random.randint(0, 60 * 60)
    return expire
 
 
def get_now_date():
    date = datetime.datetime.now()
    return date
 
 
# 转为价格,四舍五入保留2位小数
def to_price(_decimal):
    return _decimal.quantize(decimal.Decimal("0.00"), decimal.ROUND_HALF_UP)
 
 
if __name__=="__main__":
     d1 = decimal.Decimal("0.12")
     d2 = decimal.Decimal("0.12")
     if d1==d2:
         print("123")