This paper is finally updated at 1163 Days ago, , The information may have developed or changed .
As Apple Store App Indie developer , You're going to have a limited time promotion , For your application Generate activation code ( Or coupons ), Use Python How to generate 200 Activation codes ( Or coupons )?
import random
import string
str=string.ascii_uppercase+string.digits
def getKey(length):
key=''
for i in range(0,int(length)):
key+=random.choice(str)
return key
def main():
length=input('please input length of key')
number=input('please input number of key')
keys=[]
for i in range(0,int(number)):
key=getKey(length)
if not key in keys:
keys.append(key)
else:
i-=1
path='temp/keys.txt'
with open(path,'w') as file:
for item in keys:
file.write(item+'\n')
main()
Post Views: 321