相关疑难解决方法(0)

哪个是在Python中连接字符串的首选方法?

由于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中做了哪些改变?

python string concat python-3.x

325
推荐指数
10
解决办法
62万
查看次数

标签 统计

concat ×1

python ×1

python-3.x ×1

string ×1