When writing a new tool, one of the first needs that arises is making it able to interact with the surrounding environment—to display results, track errors, and receive inputs.
Users are accustomed to certain standard ways a command-line tool interacts with them and with the system, and following this standard might be time-consuming and hard if done from scratch.
That's why the standard library in Python provides tools to achieve the most common needs in implementing software that is able to interact through a shell and through text.
In this chapter, we will see how to implement some forms of logging, so that our program can keep a log file; we will see how to implement both options-based and interactive software, and then we will see how to implement more advanced graphical output based on text.