您当前的位置: 首页 >  Python

IT之一小佬

暂无认证

  • 1浏览

    0关注

    1192博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

python生成订单号或生成任意序列

IT之一小佬 发布时间:2021-04-24 19:50:58 ,浏览量:1

python生成订单号或生成任意序列

示例代码:

import time


#  生成订单号
def get_order_code():
    #  年月日时分秒+time.time()的后7位
    order_no = str(time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())) + str(time.time()).replace('.', '')[-7:])
    return order_no


print(get_order_code())

运行结果:

关注
打赏
1665675218
查看更多评论
立即登录/注册

微信扫码登录

0.0511s