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

时间:2018-04-25 07:02:07

标签: python function debugging

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.插入输入后立即关闭 他们听起来对你们这么愚蠢,但由于我不是专家编码员,我正在努力解决它们。希望您能够帮助我。谢谢!

1 个答案:

答案 0 :(得分:0)

尝试使用追加

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)