Home  >  Article  >  Backend Development  >  python list 合并连接字符串的方法

python list 合并连接字符串的方法

WBOY
WBOYOriginal
2016-06-06 11:27:591421browse

比如下面一个list

代码如下:


binfo = ['lao','wang','python']


我们通过help方法得知,可以用string的join方法来解决。

下面我们通过空格来连接3个单词:

代码如下:


content = " ".join(binfo)
print content


结果是:lao wang python
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn