For join function in python and +

  For concatenating strings, the usual functions used by python are join and direct '+'. The following is a simple use of the join function:

result:

 

But some people will ask, what is the difference between these two methods? ? ?

 

 

 

 

 

The truth is that the efficiency of connecting a large number of strings is very low, and it will cause a lot of memory copying and garbage operations, so the efficiency of using the join function for a large number of strings will be higher~

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325286342&siteId=291194637