您好,欢迎来到花图问答。
搜索
您的当前位置:首页Python初学:做为 Apple Store App 独立开发

Python初学:做为 Apple Store App 独立开发

来源:花图问答

参考网上的文章来学习,感谢原作者!(不好意思,忘了在哪看的了)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2016/12/12 下午1:10
# @Author  : hukezhu
# @Site    : 
# @File    : 0001:生成200个激活码.py
# @Software: PyCharm


#这是使用随机数的方法

# import string as s
# import random as r
#
#
# def randomNum():
#     f = open('/Users/hukezhu/Desktop/随机数激活码.txt','w+')
#     for i in range(200):
#         randomStr = ''.join(r.choice(s.ascii_uppercase + s.digits) for x in  range(10)) + '\n'
#         f.write(randomStr)
#     f.close()
#
#
# if __name__ == '__main__':
#     randomNum()



#直接使用UUID模块

# import uuid as u
#
# def rand_uuid():
#     f = open('/Users/hukezhu/Desktop/UUID随机激活码.txt','w+')
#     for i in range(200):
#         ID = str(u.uuid1()) + '\n'
#         f.write(ID)
#
#     f.close()
#
#
#
# if __name__ == '__main__':
#     rand_uuid()





#使用主键和随机码
import string as  s
import random as  r

def rand_ID():
    f = open('/Users/hukezhu/Desktop/主键和随机码随机码.txt','w+')

    for i in range(200):
        ID = id(i)
        rand_id = str(ID)[5:]
        null = ''
        for j in rand_id:
            null += j + r.choice(s.ascii_uppercase)

        f.write(null + '\n')
    f.close()


if __name__ == '__main__':
    rand_ID()




Copyright © 2019- huatuowenda.com 版权所有 湘ICP备2023022495号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务