This article mainly introduces the Python string splicing of several methods to organize the relevant data, here provides five ways and implementation, the need for friends can refer to the following
Several ways to arrange Python string concatenation
The first is the form of a plus sign (+)
Print (' The first way to connect via a plus sign: ' + ' love ' + ' Python ' + ' \ n ')
The second type is through a comma (,)
Print (' Second way to connect by comma: ' + ' love ', ' Python ' + ' \ n ')
The third type of direct connection has no space in the middle
Print (' The third way to connect via direct Connect (a): ' + ' love ' python ' + ' \ n ') print (' Third way to connect via direct connection (ii): ' + ' love ' ' python ' + ' \ n ')
The fourth type of formatting
Print (' Fourth way to connect via format: ' + '%s '%s '% (' love ', ' Python ') + ' \ n ')
Fifth Join mode connection
Str_list = [' Love ', ' Python ']print (' The fifth way to connect via join: ' + '. Join (str_list) + ' \ n ')
Run results