Instead, it sends text to a location called the standard output stream, also known as stdout.Īll UNIX systems have three main pipes - standard input pipe ( stdin), standard output pipe ( stdout) and standard error pipe ( stderr).īy default, the standard output pipe points to the interactive window used to execute the program, so we normally see text printed out on the screen. It was not hard-coded in such a way that specified text can only be written to the display. In Python, the print() function is more flexible than you might think. It is often more flexible to perform this redirection from within the Python script itself. However, with this method, all output of the script is written to a file. If we open our newly created output.txt, we'll see the following contents: Hallo We can redirect the output of the file in the shell using a single right angle bracket: $ python3 hello.py > output.txt
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |