Standard Streams: stdin, stdout, stderr:
Standard Streams:
- stdin: Standard Input Device (Ex. Reading from Keyboa
- Stdout: Standard Output Device (Ex. Printing on Monitor)
- Stderr: Same as stdout but normally only for errors.
Internally these standard devices are implemented as files called
Standard Streams. These are available in sys Module.
After importing sys Module we can use these Standard Streams in
the same way you use other files.
import sys
- sys.stdin.read() – let you read from keyboard
- sys.stdout.write() – let you write of the standard output Device
- sys.stderr.write() – let you write the error
When we start python these files opened in:
- stdin(read mode)
- stout(write mode)
- stderr(write mode)
No comments:
Post a Comment