查个错误,第三个错了,不知道为什么,填append不可以吗,不就是要把temp列表填到password里吗
import random
def create_password(length, chars):
temp = []
for i in range(length):
temp.append(random.choice(chars))
password = ''.join(temp)
return password
print(create_password(5, "abcdefg&*?"))