Python standard library: Built-in function print (*objects, sep= ", end= ' \ n ', File=sys.stdout, Flush=false)

Source: Internet
Author: User

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)

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.