python獲取八位隨機密碼

password = ''
for i in range(8):
        current = random.randrange(0,8)
        if current > i:
                temp = random.randint(0,9)
        elif current < i:
                temp = chr(random.randint(65,90))
        else:
                temp = chr(random.randint(97,122))
        password += str(temp)
print password
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章