如何获取重复输入的代码

时间:2015-10-06 03:07:19

标签: python input repeat

基本上,我希望此代码在关闭页面之前不断询问输入。刚刚开始学习Python,如果写得非常糟糕,那就很抱歉。用Python 3.5编写,并将您输入的密码保存在文本文档中,以便记住它们。

website = input("Enter what website the password is for     ")
username = input("Enter your username     ")
password = input("Enter your password     ")  
textfile = open("usernames.txt", "a")
textfile.write(website+"         ")
textfile.write(username+"         ")
textfile.write(password+"\n")
textfile.close()

1 个答案:

答案 0 :(得分:0)

简单的方法是,

while True:
    <Your Code.....>

无限循环。

相关问题