6 User Inputs and Outputs
The key purpose of software is to produce useful output. Of the many possible outputs, one simple type of output is text displaying a useful result. Python supports this with the print() function.
The input() function has a parallel with the print() function. The input() function reads text from a console, allowing us to provide data to our programs. The use of print() and input() creates an elegant symmetry between input and output from an application.
There are a number of other common ways to provide input to a program. Parsing the command line is helpful for many applications. We sometimes need to use configuration files to provide useful input. Data files and network connections are yet more ways to provide input. ...
Get Modern Python Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.