Five ways to stitch a python string

Source: Internet
Author: User

The concatenation of strings is very common, but if the gap between each method is revealed in a large number of processes, it must be understood.

#-*-coding:utf-8-*-#@Time: 2018/6/8 22:42#@Author: Eleven#@File: Five Ways to string concatenation. py#@Software: Pycharm" "method One: plus splicing" "a='life is short .'b='I use Python'R= A +bPrint(R)" "method Two: Use the% operator" "a='life is short .'b='I use Python'R='%s%s'%(A, b)Print(R)" "method Three: Use the Format method" "a='life is short .'b='I use Python'R='{}{}'. Format (A, b)Print(R)" "method Four: Use F-string" "a='life is short .'b='I use Python'R= f'{a}{b}'Print(R)" "method Five: Str.join ()" "a='life is short .'b='I use Python'C='Hello World'R='1'. Join ([A, B, c])Print(R)" "Summary: The connection string is less f-str and the plus sign connects the connection string with the F-str and Str,join methods" "

Mindset is important.

9, eyes do not always open so big, and I ask you, hundred years later, that is your.

10, want to know the World sword Rob, but listen to the midnight sound of the slaughter door. Do not just complain about their sickness, disaster, more see violent death in your knife of sentient beings and how many?

11, hatred of others is a great loss for themselves.

12, each person has life, but not everyone knows life, and even cherish life. Life is a punishment for a man who does not know his life.

13. The person who thinks he owns wealth is actually owned by wealth.

14, the situation is the cause of distress, put down the love, you can get comfortable.

15, the fate is not to muddle through, procrastination, but to listen to the fate of personnel.

16, do not be too sure of their views, this looks less regret.

17. When you are honest with yourself, no one in the world can deceive you.

18. It is shameful to use the means of harming others to conceal one's shortcomings.

Five ways to stitch a python string

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: 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.