记录器GET /调用console.log

时间:2018-12-07 22:33:12

标签: node.js

需要帮助将所有GEt请求/调用记录到console.log。我已经尝试过其他方法,但仍然遇到问题

def hide_word():
    #hides the word with underscores
    secret_word = sub_theme()
    secret_word_len = len(secret_word) - 1
    hide = ""
    for letter in secret_word :

        if letter in [" " , "," , ":" , "'" , "-" , "_" , "&" , "é", '"', "/" , "." , "?" , "!"]:
            hide = hide + letter

        elif letter in "\n" :
            hide = hide

        else:
            hide = hide + "_ "

    print(secret_word_len)
    print(hide)
    return hide, secret_word

def guessing():
    player_guess = ""
    #guesses_left = manage_difficulty() 
    secret_word = hide_word() [1]
    dashes = hide_word() [0]
    player_guess = input("Guess a letter (only one at a time)")

    if len(player_guess) > 1:
        print("Only one letter please")

    if len(player_guess) == 1:
        count = 0

        #### if the player guesses correctly ####
        if player_guess in secret_word.casefold() :
            print(player_guess + "is correct") 

            ### where the dash has to be updated ####
            for letter in secret_word :
                ### if the player guesses correctly ####
                if letter.casefold() == player_guess :
                    print(letter + "needs replacing")
                    dashes = dashes + letter 
                else:
                    print(letter + "stays a dash")
                count += 1
                print(dashes)
        else:
            print("wrong guess")

    else: 
        print("please type something")

0 个答案:

没有答案