1# bin()#二进制 # r = bin(11) # print(r) 2 # oct()#八进制 # r = oct(14) # print(r) 3 # int()#十进制 4 # hex()#十六进制 # r = hex(14) # print(r) 5 #二进制转十进制 # i = int('0b11',base = 2) # print(i) 6# 生成一个随机数,65-90
# 数字转化为正字母:chr(数字) # import random # temp = "" # for i in range(6): # num = random.randrange(0,4) # if num == 3 or num == 1: # rad2 = random.randrange(0,10) # temp = temp + str(rad2) # else: # rad1 = random.randrange(65,91) # c1 = chr(rad1)#数字转换为正字母 # temp = temp +c1 # print(temp) 7 #验证码 # import random # temp = "" # for i in range(6): # num = random.randrange(0,4) # if num == 1 or num == 3: # rad1 = random.randrange(0,9) # temp = temp + str(rad1) # else: # rad2 = random.randrange(65,91) # c = chr(rad2) # temp = temp + c # print(temp) #sort # char = ["sad","2","1","没"] # new_char = sorted(char) # print(new_char)