Python程序不显示print()并关闭其

2022-05-21 07:14:57 发布

您现在位置:Python中文网/ 问答频道 /正文

services_array = []
passwords_array = []

def main_program():

    user_service = input("Il nome del servizio è: ")
    services_array = [user_service]

    user_password = input("Inserisci la password: ")
    passwords_array = [user_password]


def show_inputs(services_array, passwords_array):
    for services in services_array:
       for passwords in passwords_array:
           print (services + " --------- "+ passwords)

main_program()
show_inputs(services_array, passwords_array)

我是python新手,正在使用Pycharm编写代码。我刚开始编写这个密码管理器,当我运行它时,我遇到了一些问题: 1.它不会打印出您的输入 2.插入输入后,它立即关闭 他们可能听起来很愚蠢,但因为我不是一个专家编码,我正在努力解决他们。希望你能帮助我。谢谢


Tags: inforinputmaindefshowservicepasswordprogramarrayilinputsusernomepasswords
1条回答
网友
1楼 ·

尝试使用append

services_array = []
passwords_array = []

def main_program():

    user_service = input("Il nome del servizio è: ")
    services_array.append(user_service)

    user_password = input("Inserisci la password: ")
    passwords_array .append(user_password)


def show_inputs(services_array, passwords_array):
    for services in services_array:
       for passwords in passwords_array:
           print (services + "     - "+ passwords)

main_program()
show_inputs(services_array, passwords_array)