[Python] How to log input and output into a text file in Python?

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    Is there a way to save the program input and output to a text file? Let's have a really simple application and say I want to log the shell to a "log.txt" file.

    What's your name?
    Peter

    How old are you?
    35

    Where are your from?
    Germany

    Hi Peter, you're 35 years old and you're from Germany!


    I believe that the logging module could be the way but I don't know how to use it.

    Continue reading...

Compartilhe esta Página