1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/usr/bin/env python #-*-coding=utf-8 -*- #AUTHOR:duwentao import random chechkcode = '' for i in range ( 4 ): current = random.randrange( 0 , 4 ) #字母 if current = = i: tmp = chr (random.randint( 65 , 90 )) #数字 else : tmp = random.randint( 0 , 9 ) chechkcode + = str (tmp) print (chechkcode) |