This function is the implementation of the object in a string representation of the format output to The stream file object files . where all non-keyword parameters are converted to string output by str () , the keyword parameter Sep is the implementation delimiter, such as multiple parameter output when you want to output the middle separator character; keyword parameters End is the character at the end of the output, the default is a newline character \ n; the keyword parameter file is the document that defines the stream output, which can be the standard system output sys.stdoutcan also be redefined as other files; the parameter flush is the immediate output of the content to the stream file, not cached.
Example:
#print () print (1, 2, 3, Sep = ', ', end = ' \ r \ n ') print (1, 2, 3, Sep = ', end = ' \ r \ n ') with open (R ' C:\\abc1.txt ', ' W ') as D Emo: print (1, 2, 3, 88888888888, Sep = ', ', end = ' \ n ', File = demo)
The resulting output is as follows:
The
1 2 3
Files in abc1.txt :
1,2,3,88888888888
Cai Junsheng qq:9073204 Shenzhen
Python standard library: Built-in function print (*objects, sep= ", end= ' \ n ', File=sys.stdout, Flush=false)