Beispiel #1
0
    def _read_inputs_(self, input_dict):
        """Gets the values from the user for a workflow input.
            If user provieds empty value, then default value is returned for the workflow input,
                if it is specified.
            Else, prompts the user again for the input.

            Args:
                input_dict (dict)   --  dictionary containing the values for a workflow input
                    {'input_name', 'display_name', 'documentation', 'default_value', 'is_required'}

            Returns:
                str - value entered by the user for the workflow input
        """
        if input_dict['display_name'] is not None:
            prompt = input_dict['display_name']
        else:
            prompt = input_dict['input_name']

        if input_dict['is_required']:
            value = raw_input(prompt + '*' + '::  ')
        else:
            value = raw_input(prompt + '::  ')

        if value:
            return value
        elif input_dict['default_value']:
            return input_dict['default_value']
        else:
            return self._read_inputs_(input_dict)
def main():
    welcome()
    my_region = raw_input("Enter your region name: ")
    print(
        'Please wait! The system is in a process into connecting to your AWS Environment.'
    )
    time.sleep(3)
    ec2_conn = conn_to_my_aws(my_region)
    print('The System is displaying all instance ids in your region {}'.format(
        my_region))
    list_instances(ec2_conn)
    instance_id = raw_input("Enter the instance id for your ec2 node: ")
    start_stop = raw_input(
        "Enter either stop or start command for your ec2-instance: ")
    while True:
        if start_stop not in ["start", "stop"]:
            start_stop = raw_input("Enter only stop or start commands: ")
            continue
        else:
            break
    if start_stop == "start":
        start_instance(ec2_conn, instance_id)
    else:
        stop_instance(ec2_conn, instance_id)
    Thank_you()
Beispiel #3
0
def main():
    global custom
    print("welcome")
    # create input and output folders
    if not os.path.isdir(os.path.join(os.getcwd(), "inputs")):
        os.mkdir(os.path.join(os.getcwd(), "inputs"))
    if not os.path.isdir(os.path.join(os.getcwd(), "outputs")):
        os.mkdir(os.path.join(os.getcwd(), "outputs"))

    # userMadlib determines whether we re-enter first menuHandler
    userMadlib = ""
    while userMadlib is "":
        # Initial user input
        choice = raw_input(makeSelection)  # welcome and first decision
        userMadlibAndCustom = welcomeMenuHandler(choice)
        custom = userMadlibAndCustom[1]
        userMadlib = userMadlibAndCustom[0]
    print("User's madlib is:", userMadlib)
    # At this point we have an unprocessed user madlib regardless of where it came from

    # Save and quit, play or print
    choice2 = raw_input(
        "Do you wish to:\n1. Fill in your madlib now\n2. Print a physical version\n3. Quit\n"
    )
    filledMadlib = madlibMainMenuHandler(choice2, userMadlib, custom)
    if filledMadlib is not None:
        print("Your madlib:", ' '.join(filledMadlib))
Beispiel #4
0
def welcomeMenuHandler(choice):
    custom = {}
    save_manual_file = True
    print("User selects:", choice)
    base_name = ""
    if choice == "1":
        print("Manual")
        userMadlib = enterMadlibManual()
        savequest = raw_input("Would you like to save?\n")
        if savequest == "yes":
            base_name = raw_input(
                "Enter your desired filename (without extention)\:\n")
            file_write(' '.join(userMadlib), base_name, 'inputs', '.txt')
        elif savequest == "no":
            save_manual_file = False
        else:
            print(potato)
            exit()
    elif choice == "2":
        print("From file")
        filename = input("Enter a madlib filename with the extension:\n")
        base_name = os.path.splitext(filename)[0]
        userMadlib = enterMadlibFile(filename)
    elif choice == "3":
        instructionsMenuHandler()
        userMadlib = ""
    else:
        print("invalid entry")
        userMadlib = ""
    if userMadlib is not "":
        custom = customWordsFilter(userMadlib, base_name, save_manual_file)
    return userMadlib, custom
def keyword_convert(ind, wrd, ca, custom):
    base = re.findall(unnumbered, wrd)
    base = ''.join(base)
    if ca == 0:
        print(generic_words[ind] + ': ')
    elif ca == 1:
        print(generic_words[base] + ': ')
        new = raw_input()
        numword_dic[ind] = new
        return re.sub(ind, new, wrd)
    elif ca == 2:
        new = numword_dic[ind]
        return re.sub(ind, new, wrd)
    elif ca == 3:
        print(custom[base] + ':')
    elif ca == 4:
        print(custom[base] + ': ')
        new = raw_input()
        numword_dic[ind] = new
        return re.sub(ind, new, wrd)
    elif ca == 5:
        print(
            ind,
            "hasn't been configured, what would you like to replace it with?")
    else:
        print(ind, "is not a valid keyword, enter what to fill it with: ")
    new = raw_input()
    return re.sub(ind, new, wrd)
def pvsys_defs_user_input(npts=101, user_set_temp=False, tcell=298.15):
    """
    Prompt a user to input array definitions from the command line. Returns all
    info necessary to create a PVsystem instance
    """
    modsizeinput = int(raw_input("Module Size? (1=72c, 2=96c, 3=128c): "))
    while modsizeinput != 1 and modsizeinput != 2 and modsizeinput != 3:
        modsizeinput = input("Please input 1, 2, or 3, please. ")
    if modsizeinput == 1:
        cellpos = STD72
        modHeight = 12
        numCells = 72
    elif modsizeinput == 2:
        cellpos = STD96
        modHeight = 12
        numCells = 96
    elif modsizeinput == 3:
        cellpos = STD128
        modHeight = 16
        numCells = 128
    tcell = int(raw_input("Cell temperature (deg C)? "))
    tcell = tcell + 273.15
    pvcelldict = {'Tcell': tcell, 'pvconst': PVconstants(npts=npts)}
    pvmoddict = {
        'cell_pos': cellpos,
        'Vbypass': -0.5,
        'pvconst': PVconstants(npts=npts)
    }
    pvcell = PVcell(**pvcelldict)
    pvmod = PVmodule(pvcells=pvcell, **pvmoddict)
    pvsys = PVsystem(pvmods=pvmod,
                     numberStrs=1,
                     numberMods=1,
                     pvconst=pvmod.pvconst)
    return pvsys, modHeight, numCells
Beispiel #7
0
    def _read_inputs_(self, input_dict):
        """Gets the values from the user for a workflow input.
            If user provieds empty value, then default value is returned for the workflow input,
                if it is specified.
            Else, prompts the user again for the input.

            Args:
                input_dict (dict)   --  dictionary containing the values for a workflow input
                    {'input_name', 'display_name', 'documentation', 'default_value', 'is_required'}

            Returns:
                str - value entered by the user for the workflow input
        """
        if input_dict['display_name'] is not None:
            prompt = input_dict['display_name']
        else:
            prompt = input_dict['input_name']

        if input_dict['is_required']:
            value = raw_input(prompt + '*' + '::  ')
        else:
            value = raw_input(prompt + '::  ')

        if value:
            return value
        elif input_dict['default_value']:
            return input_dict['default_value']
        else:
            return self._read_inputs_(input_dict)
Beispiel #8
0
def olduser():
    name = raw_input('login: '******'passwd: ')
    passwd = db.get(name)
    if passwd == pwd:
        print('welcome back', name)
    else:
        print('login incorrect')
Beispiel #9
0
def deauth():
    ssid_mac = raw_input(
        'Please enter the SSID mac for Deauthentication Attack: \n')
    while (not is_mac_valid(ssid_mac)):
        ssid_mac = raw_input('Wrong MAC address please try again: \n')
        is_mac_valid(ssid_mac)
    print('making attack for mac -> %s \n' % ssid_mac)
    dot11 = Dot11(addr1=ssid_mac, addr2=target, addr3=target)
    packet = RadioTap() / dot11 / Dot11Deauth()
    sendp(packet, inter=0.001, count=1000, iface=interface)
Beispiel #10
0
def newuser():
    prompt = 'login desired: '
    while True:
        name = raw_input(prompt)
        if name in db:
            prompt = 'name taken, try another: '
            continue
        else:
            break
    pwd = raw_input('passwd: ')
    db[name] = pwd
    def snap(cls):
        """

        :return:
        """
        raw_input('Press Enter to capture')
        return_value, img_arr = cls.camera.read()
        img_arr = cv2.cvtColor(img_arr, cv2.COLOR_BGR2RGB)
        img = Image.fromarray(img_arr)

        buffered = BytesIO()
        img.save(buffered, format="JPEG")
        imgstr = buffered.getvalue()
        return imgstr
def invalid_html(ch, RK, wrd):
    if ch == 0:
        ch = raw_input(RK + ' is not a valid key, did you want it to be?')
    elif ch == 1:
        ch = raw_input(RK + ' is not configured, did you mean to do it?')
    if ch == 'yes':
        new = raw_input('What is the word\'s category?')
        latword = htmlsample.replace('underscript', new)
        final = wrd.replace(RK, latword, 1)
        return final
    elif ch == 'no' or ch == '':
        return wrd
    else:
        print(potato2)
        exit()
Beispiel #13
0
def watch(streams):
    if len(streams) > 0:
        print("Channels online:")
        i = 1
        for s in streams:
            print("({}) {}: [{}] {}".format(i, s['name'], s['game'],
                                            s['desc']))
            print("{} {}".format(' ' * (2 + len(str(i))), s['url']))
            i += 1

        while True:
            print()
            input = raw_input("Enter number of stream to watch: ")

            try:
                stream_number = int(input)
                break
            except ValueError:
                print("Please specify the number of the stream to watch.")
                continue

        command = "livestreamer {} best".format(streams[stream_number -
                                                        1]['url'])
        call(command.split(), shell=False)

    else:
        print("No streams online.")
Beispiel #14
0
def query_yes_no(question, default="yes"):
    """Ask a yes/no question via raw_input() and return their answer.

    "question" is a string that is presented to the user.
    "default" is the presumed answer if the user just hits <Enter>.
        It must be "yes" (the default), "no" or None (meaning
        an answer is required of the user).

    The "answer" return value is True for "yes" or False for "no".
    """
    valid = {"yes": True, "y": True, "ye": True,
             "no": False, "n": False}
    if default is None:
        prompt = " [y/n] "
    elif default == "yes":
        prompt = " [Y/n] "
    elif default == "no":
        prompt = " [y/N] "
    else:
        raise ValueError("invalid default answer: '%s'" % default)

    while True:
        sys.stdout.write(question + prompt)
        choice = raw_input().lower()
        if default is not None and choice == '':
            return valid[default]
        elif choice in valid:
            return valid[choice]
        else:
            sys.stdout.write("Please respond with 'yes' or 'no' "
                             "(or 'y' or 'n').\n")
Beispiel #15
0
def search_contacts():
    # otwórz książkę telefoniczną
    phonebook = shelve.open('phonebook.txt')
    # do zmiennej temp wypakuj zawartość phonebook['contacts']
    temp = phonebook['contacts']

    # print("temp:", temp)
    # temp: ['Janusz Cebula', 'jja', 'sdgsf'
    # temp[0]: ['Janusz Cebula']

    # zmienna przechowująca dane od użytkownika czego chce szukać
    search_choice = raw_input("What do you want to search for?: ")
    print("\n")
    # tyle razy ile jest elemetów w temp
    for i in range(len(temp)):
        # do zmiennej contact_data przypisz kontakt, i wskazuje na indeks kontaktu.
        contact_data = phonebook[temp[i]]  # = phonebook['Janusz Cebula']

        # print("Contact_data", contact_data)
        # Contact_data
        # {'1': 'Janusz', '2': 'Cebula', '3': 'Sosnowiec', '4': 'asas', '5': 'asasa', '6': 'asa', '7': 'a', '8': 'asa',
        # '9': 'as'}

        if search_choice in contact_data.values():
            print("Found: \n")
            print("Name: %s" % contact_data['1'])
            print("Surname: %s" % contact_data['2'])
            print("Phone: %s" % contact_data['3'])
        else:
            print("No such information")
            print("\n")
            break
Beispiel #16
0
def list_contacts():
    # otwórz książkę telefoniczną
    phonebook = shelve.open('phonebook.txt')
    # do zmiennej temp wypakuj zawartość phonebook['contacts'] - listę kontaktów
    temp = phonebook['contacts']
    # tyle razy ile jest elemetów w temp
    if temp:
        for i in range(len(temp)):
            # wyświetl kontakty o indeksach od 0 do tylu ile jest elementów w temp
            print("Contact name: %s\n" % temp[i])
            # do zmiennej choice przypisz wybór użytkownika, będzie to klucz w słowniku
            choice = raw_input("What to open: ")
            # do zmiennej contact data wypakuj kontakt (słownik) z listy kontaktów o nazwie jaka była przekazana
            # przez użytkownika
            if choice in phonebook:
                contact_data = phonebook[choice]
                # wyświetla poszczególnie zawartość słownika dla kontaktu
                print("\n")
                #                 wywołanie:  słownik['klucz'] - wyświetli "Name: wartość"
                print("Name: %s" % contact_data['1'])
                print("Surname: %s" % contact_data['2'])
                print("Phone: %s" % contact_data['3'])
                print("\n")
            else:
                print("No contact in phonebook")
                print("\n")
    else:
        print("There are no contacts in phonebook yet.")
        print("\n")
        pass
Beispiel #17
0
def main():
    n = int(raw_input('Enter value of n: '))
    m0 = random.randint(2, n / 5)
    G = nx.path_graph(m0)
    # display_graph(G, '', '')
    G = add_nodes_barabasi(G, n, m0)
    # plot_deg_distribution(G)

    print('Edges: ', G.edges())

    for i in G.nodes():
        for j in G.nodes():
            if i != j:
                edge = str(i) + str(j)
                path = nx.dijkstra_path(G, i, j)
                pathL = path.__len__() - 1
                # print('Shortest path from node ', i, ' to ', j, ' : ', path)
                if not pathL in path_lengths:
                    path_lengths[pathL] = 1
                else:
                    path_lengths[pathL] += 1
    print(path_lengths)
    s = OrderedDict(sorted(path_lengths.items(), key=lambda t: t[0]))
    names = list(s.keys())
    values = list(s.values())
    plt.bar(range(len(s)), values, tick_label=names)
    plt.xlabel('Path length')
    plt.ylabel('Frequency')
    plt.show()
Beispiel #18
0
def readCustomFile(filename):

    filename = raw_input(
        "Which file would you like to process? (include the extension, only .txt and .docx supported)\n"
    )
    # saving name of custom word file
    if re.search("\.docx$", filename):
        # docx file
        cont = textract.process("inputs/" + filename)
        # supplement for the replacement function
        text = str(cont)
        text = text.replace("\\xe2\\x80\\x9c", '"')
        text = text.replace("\\xe2\\x80\\x9d", '"')
        text = text.replace('\\xe2\\x80\\x98', "\'")
        text = text.replace('\\xe2\\x80\\x99', "\'")
        cont = text
    elif re.search("\.txt$", filename):
        customfile = filename.replace('.txt', '_cts.txt')
        print(customfile)
        # reading main content file
        choice = os.path.join('inputs', filename)
        my_file = open(choice, "r")
        cont = my_file.read()
    else:
        print("file invalid")
        quit()

    #inputList = cont.split(" ")
    return cont
def watch(streams):
    if len(streams) > 0:
        print("Channels online:")
        i = 1
        for s in streams:
            print("({}) {}: [{}] {}".format(i, s['name'], s['game'], s['desc']))
            print("{} {}".format(' ' * (2 + len(str(i))), s['url']))
            i += 1

        while True:
            print()
            input = raw_input("Enter number of stream to watch: ")

            try:
                stream_number = int(input)
                break
            except ValueError:
                print("Please specify the number of the stream to watch.")
                continue

        command = "livestreamer {} best".format(streams[stream_number - 1]['url'])
        call(command.split(), shell=False)

    else:
        print("No streams online.")
Beispiel #20
0
def invoke_editor(extractedTraceback):
    p4.func.writeInColour("\nWhere do you want to go? ...\n", colour="blue")

    te = extractedTraceback
    for teItemNum in range(len(te)):  # te is a traceback.extract_tb() result
        theTeItem = te[teItemNum]
        p4.func.writeInColour("%2i" % teItemNum, colour='red')
        print("  line %4i,  %s" %  (theTeItem[1], theTeItem[0]))
    p4.func.setTerminalColour("blue")
    ret = raw_input('Tell me a number (or nothing to do nothing): ')
    p4.func.unsetTerminalColour()
    #print "Got %s" % ret
    retNum = None
    if ret == '':
        pass
    else:
        try:
            retNum = int(ret)
            if retNum < 0 or retNum >= len(te):
                retNum = None
        except ValueError:
            pass
    if retNum != None:
        theTeItem = te[retNum]
        theFileName = theTeItem[0]
        if os.path.isfile(theFileName):
            try:
                theLineNum = int(theTeItem[1])
                theCommand = "%s +%i %s" % (var.excepthookEditor, theLineNum, theFileName)
                os.system(theCommand)
            except:
                print("...could not make an int from theLineNum '%s'" % theLineNum)
                pass
        else:
            print("-> '%s' is not a regular file" % theFileName)
Beispiel #21
0
def edit_contacts():
    phonebook = shelve.open('phonebook.txt')
    # wyładuj do zmiennej listę kontaktów
    temp = phonebook['contacts']
    # wyświetl kontakty
    print(temp)
    print("\n")
    # zmienna zabezpieczająca, na razie pusta lista
    backup = []
    # do zmiennej pobierz to co wpisał użytkownik
    edit_choice = raw_input("Which contact you want to edit: ")
    print("\n")
    # jeżeli to co wpisał użytkownik jest w książce
    if edit_choice in phonebook:
        # do zmiennej contact_data zaladuj słownik kontaktu tj. słownik przypisany do np Janusza Cebuli
        contact_data = phonebook[edit_choice]
        # wyświetl dane kontaktu
        print("Contact data: \n")
        # wyświetla poszczególne dane kontaktu, którego dotyczy zmiana
        print("1.Name: %s" % contact_data['1'])
        print("2.Surname: %s" % contact_data['2'])
        print("3.Phone: %s" % contact_data['3'])
        print("\n")
        # zmienna przechowująca wybór użytkownika, dot którą informację chce zmienić
        inf_choice = int(raw_input("Which information you want to change?: "))
        # do numerów przypisane są intrukcje
        if inf_choice == 1:
            # jeżeli użytkownik wybrał 1, do contact_data, w pierwszym miejscu zmień na to co wpisze użytkownik
            contact_data['1'] = raw_input("New name: ")
        elif inf_choice == 2:
            contact_data['2'] = raw_input("New surname: ")
        elif inf_choice == 3:
            contact_data['3'] = raw_input("New phone: ")
            # jeżeli wpisze coś innego
        else:
            print
            "There is no such information. "
        # zmiennej zapasowej (pustej listy) wstaw słownik (NOWE dane) wybranego kontaktu
        backup = contact_data
        # usuń z książki (listy kontaktów) element (użytkownika), którego dotyczyła edycja
        del (phonebook[edit_choice])
        # w ten sam element wpisz zawartość zmiennej (nowy słownik - nowe dane)
        phonebook[edit_choice] = backup
        # jeżeli to co wpisał użytkownik nie jest takie samo jak nazwa kontaktu
    else:
        print
        "No such contact "
Beispiel #22
0
def save_contact():
    phonebook = shelve.open('phonebook.txt')
    # dla każdego elementu w przedziale ilości elementów phonebook[entry]
    # for i in range(len(phonebook['contacts'])):
    # do zmienej tmp wsadź to co jest w phonebook['entry'] - lista kluczy
    temp = phonebook['contacts']
    # nowy słownik "x"
    contact_data = {}
    # w nowym słowniku przypisz do kluczy x['1'],x['2'] wartości.
    # będzie tak x['1'] Janusz | {1 : "Janusz"}
    contact_data['1'] = raw_input("Name: ")
    contact_data['2'] = raw_input("Surname: ")
    contact_data['3'] = raw_input("Phone: ")
    print("\n")
    # do phonebooka o kluczu z ostatniej pozycji tmp, czyli ostatniej dodanej osoby przypisz słownik x
    phonebook[temp[-1]] = contact_data
    phonebook.close()
Beispiel #23
0
def ui():
    """
    与用户交互
    """
    welcome = 'train or test[exit or 回车退出]:'
    user_input = raw_input(welcome)
    while user_input != '':
        # 退出
        if user_input == 'exit':
            break
        # 选择训练模型
        if user_input == 'train':
            into_train()
        # 选择功能测试
        if user_input == 'test':
            into_test()
        user_input = raw_input(welcome)
def get_input():
    lines = []
    try:
        while True:
            lines.append(raw_input())
    except EOFError:
        pass
    lines = "\n".join(lines)
    return lines
Beispiel #25
0
def start_cli():
    while True:
        try:
            db_cursor.execute(raw_input("Enter query "))
            r = db_cursor.fetchall()
            pprint(r)
            db.commit()
        except _mysql_exceptions.ProgrammingError as e:
            print(str(e))
Beispiel #26
0
def madlibMainMenuHandler(choice, userMadlib, custom):
    print("user choice:", choice)
    filledMadlib = None
    if choice == "1":
        print("Fill in")
        filledMadlib = fillInMadlib(userMadlib, custom)
        print(' '.join(filledMadlib))
        choice = raw_input(
            "Would you like to save this filled madlib to the \"outputs\" folder?\n"
        )
        if choice == 'yes':
            filename = raw_input(
                "What do you wish to name the file? (do not type the extension): "
            )
            file_write(' '.join(filledMadlib), filename, 'outputs', '.txt')
            print(
                "Your filled madlib has been saved to the outputs folder, have a good day!"
            )
        elif choice == 'no' or choice == '':
            print("Have a good day!")
        else:
            print(potato2)
            exit()
    elif choice == "2":
        print("print physical")
        htmlList = createHtmlMadlib(userMadlib)
        latfill = ' '.join(htmlList)
        head = raw_input("What would you like to title this madlib?\n")
        latfill = htmlhead.replace('heading', head,
                                   1) + latfill + ' </p></body></html>'
        filename = raw_input(
            "What do you wish to name the file? (do not type the extension):\n"
        )
        file_write(latfill, filename, 'outputs', '.html')
        print(
            "An HTML coded version of your unfilled madlib has been saved to the outputs folder, "
            "drag the file into your browser to view it. Print the file using your respective browser's print feature.\n"
            "Have a good day!")
    elif choice == "3":
        print("quit")
    else:
        # print(potato)
        print("Invalid instruction choice:", choice, "Please try again...")
    return filledMadlib
Beispiel #27
0
def profiling_sigint_handler(signal, frame):
    pr.disable()
    s = StringIO.StringIO()
    ps = pstats.Stats(pr, stream=s).sort_stats('cumulative')
    ps.print_stats(.2)
    print(s.getvalue())

    print('------------------------')
    if raw_input('continue? (y/n) ') != 'y':
        exit(0)
Beispiel #28
0
 def run(self):
     while True:
         data = conn.recv(2048)
         # print "Server received data:", data
         MESSAGE = raw_input(
             "Multi threaded server: Enter response from server/enter exit:"
         )
         if MESSAGE == 'exit':
             break
         conn.send(MESSAGE)  #echo
Beispiel #29
0
def parse_bool(question, default=True):
    choices = 'Y/n' if default else 'y/N'
    default = 'Y' if default else 'N'
    while True:
        ans = raw_input('%s [%s]: ' % (question, choices)).upper() or default
        if ans.startswith('Y'):
            return True
        elif ans.startswith('N'):
            return False
        else:
            print('Invalid selection (%s) must be either [y]es or [n]o.' % ans)
Beispiel #30
0
def start_polling(updater: Updater, message_queue: MessageQueue) -> None:
    """
    Starts the bot.

    :return: None
    """
    try:
        updater.start_polling()
    except (Unauthorized, InvalidToken) as err:
        logging.error(err.message)
        logging.info("Check your API-Token in the config file")
        logging.info("Exiting...")
        raw_input()
        sys.exit(-1)
    except NetworkError:
        updater.start_polling()
    scheduler.start()
    updater.idle()
    scheduler.shutdown()
    message_queue.stop()
Beispiel #31
0
def menu():
    print(
        "Press (1) to change a password. | Press (2) to enter your password.")
    prompt = raw_input("What would you like to do?\n")

    if prompt == "1":
        change()
    if prompt == "2":
        enter()
    else:
        print("That is not a valid option!")
Beispiel #32
0
def into_test():
    """
    根据用户输入句子返回类别
    """
    # 载入模型,默认载入default
    name = raw_input('输入要加载的模型名,默认加载default.pt:')
    name = name if name != '' else 'default'
    model = model_load(name)
    # 模型载入成功
    if model is not None:
        # 读取用户输入
        user_input = raw_input('请输入[exit or 回车退出]:')
        # 输入非空
        while user_input != '':
            if user_input == 'exit':
                break
            # 获取类别
            label = get_label(model['net'], model['vocab'], model['category'], user_input)
            # 打印
            print(label)
            # 继续监听输入
            user_input = raw_input('请输入[exit or 回车退出]:')