Python standard library: built-in function print (* objects, sep = '', end = '\ n', file = sys. stdout, flush = False), pythonsys. stdout
This function is used to format and output an object in a string representation to a stream file object file.
In general, the sys. stdout function is similar to the file output function fprintf in C ++.
Next, let's take a look at the Code:
>>> Import sys >>> temp = sys. stdout >>> sys. stdout = open ('e: \ pythonCode \ 1.txt ', 'w') # Note: dual \> print 1
When a C language program is started, the operating system environment is responsible for opening three files and providing pointers to these three files to the program. The three files are standard input (stdin), standard output (stdout), and
The code, connection information, and annotations in the ELF file are stored in sections (section) and contain a
Header table (section header). For each section, there is a table entry in the section Header table (section Header table
Transferred from: http://www.codingpy.com/article/why-print-became-a-function-in-python-3/In Python 2, print is a statement (statement), and in Python 3 it becomes a function. Many Python users ask, why is Python 3 turning print into a function?
This article is based on Python2.7 and describes several common stdout redirection methods. Obviously, these methods also apply to standard error redirection. You can learn from python.
I. Background
In Python, file
Detailed explanation of several standard output redirection methods in python and python redirection
I. background
In Python, file objectssys.stdin,sys.stdoutAndsys.stderrCorresponding to the standard input, standard output, and standard error
First, IntroductionLOG4J is an Apache open source project, by using log4j, we can control the destination of log information delivery is console, file, GUI component, even socket server , NT Event recorder, UNIX syslog daemon, etc. We can also
Recently made a project, want to print different logs to different files, configured as follows:
Log4j.rootcategory=debug, stdout Log4j.rootlogger=debug, stdout, FILE # # # # stdout # # # log4j.appender.stdout= Org.apache.log4j.ConsoleAppender Log4
Directory
Directory preface software Environment Knowledge Subprocess Popen Constructor constructor Class Popen parameter args calling program call shell instruction Stdinstdoutstderr real-time fetch subroutine output one time get all output of
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.