original_df5b04387471f04817beeb6dcdc891c6.jpg

    1. import random
    2. # 最大卡片数
    3. max_card = random.randint(1,25)
    4. nums = []
    5. for _ in range(max_card):
    6. car_num = random.randint(0, 999999)
    7. nums.append(car_num)
    8. # nums 排序
    9. nums.sort(reverse=True)
    10. # print(nums)
    11. # 讲nums中的每个数字转换为字符串
    12. nums_str = [str(n) for n in nums]
    13. # 数字拼接为字符串
    14. newstr = "".join(nums_str)
    15. print(newstr)

    original_441d76820850b671257ccf737612546e.jpg