0
我正在python中創建一個程序,用於根據用戶的輸入生成一個隨機passwrod。到目前爲止我的代碼是:Python - 輸出列表
from random import *
symbols = ['!','"','£','$','%','^','&','*','(',')','-','_','=','/','*','-','+','{','}','[',']',':',';','@','>','#','~','<',',','.','?']
rand1 = randint(0,32)
rand2 = randint(0,32)
fore = raw_input('Enter your forename')
sur = raw_input('Enter your Surname')
birth = raw_input('Enter you birth year')
password = symbols[rand1], fore[0:2], sur[0:3], birth[2:4], symbols[rand2]
print password
當程序輸出的密碼,它看起來像這樣:
('+', u'jo', u'smi', u'90', '/')
反正是有擺脫多餘的字符如括號和逗號?
你怎麼辦?有沒有任何答案適合你? –
@ T3H40你給的解決方案工作!謝謝! :) –