由于Python string无法更改,我想知道如何更有效地连接字符串?
我可以这样写:
s += stringfromelsewhere
Run Code Online (Sandbox Code Playgroud)
或者像这样:
s = []
s.append(somestring)
later
s = ''.join(s)
Run Code Online (Sandbox Code Playgroud)
在写这个问题时,我发现了一篇很好的文章谈论这个话题.
http://www.skymind.com/~ocrow/python_string/
但它是在Python 2.x.中,所以问题是在Python 3中做了哪些改变?