标签:python
第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
https://github.com/Yixiaohan/show-me-the-code
import random codeLength = 12 codeCount = 200 codeOrig = "ABCDEFGHIJKLMNOPQRST1234567890" def makePromoteCode(count): for i in range(count): promotecode = "" for x in xrange(codeLength): promotecode += random.choice(codeOrig) print promotecode if __name__ == ‘__main__‘: makePromoteCode(codeCount)
本文出自 “ryanscn” 博客,请务必保留此出处http://ryanscn.blog.51cto.com/2725212/1751070
标签:python
原文地址:http://ryanscn.blog.51cto.com/2725212/1751070