Get the App
SLTechnology News&Howtos  ›  Development  › 

How Python splices strings

Shulou Source: shulou.com Published: 2022-06-01 13:20:01 10月03日 Update

In this article Xiaobian for you to introduce in detail "Python how to splice strings", the content is detailed, the steps are clear, the details are handled properly, I hope this "Python how to splice strings" article can help you solve your doubts, following the editor's ideas slowly in-depth, let's learn new knowledge.

The first uses the + sign to achieve:

Print ('Love'+'Python')

The output is: LovePython

The second is to use the symbol to achieve:

Print ('Love','Python')

The output is: Love Python

The third is the first kind of deformation, the existence of spaces between characters does not affect the output result:

Print ('Love''Python')

The output is: LovePython

The fourth way to format:

Print ('% s% s'% ('Love',' Python'))

The output is: Love Python

The fifth way is to use join to concatenate.

Str_list = ['Love',' Python'] print ('. Join (str_list))

The output is: LovePython

After reading this, the article "how to assemble strings in Python" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, please follow the industry information channel.

Tags: Results output characters strings articles content methods appropriateness between ideas new knowledge more formats steps knowledge knowledge points spaces articles details industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft macOS Xiaomi MySQL Linux