Implementing multiple print outputs in Python to synthesize an array

Source: Internet
Author: User
Below for everyone to share a python implementation of the multiple print output is synthesized an array, with a good reference value, I hope to help you. Come and see it together.

For example, there is the following code:

For I in range: print ("%s"% (F_list[i].name))

The execution of the code snippet generates a string of 10 lines of the "name" property as follows

F1f2f3f4f5f6f7f8f9f10

If we modify the above code snippet as follows:

For I in range: print ("\"%s\ ","% (F_list[i].name)),

The result of the code execution becomes the following:

"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",

In this way, we can use the above execution results to construct the desired array. Like what:

Flownamelist = ["F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10"]

Attention:

A comma ', ' is added at the end of the print statement to make the print output non-wrapped;

Output double quotation mark ' ', need to use the escape character ' \ '.

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.