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. All non-Keyword parameters are converted to string output in the str () mode. The keyword parameter sep is a delimiter. For example, if multiple parameters are output, you want to output intermediate separator characters; the keyword parameter end is the character at the end of the output. The default value is the line break \ n. the keyword parameter file is the file defining the stream output, which can be the standard system output sys. stdout can also be redefined as another file. The flush parameter immediately outputs the content to the stream file without caching it.
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 demo: print (1, 2, 3, 88888888888, sep = ',', end = '\ n', file = demo)
The output is as follows:
1, 2, 3
1 2 3
In the abc1.txt file:
1, 2, 3, 888888888
Cai junsheng QQ: 9073204 Shenzhen