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

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

WBOY
Release: 2016-06-06 11:27:59
Original
1472 people have browsed it

比如下面一个list

代码如下:


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


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

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

代码如下:


content = " ".join(binfo)
print content


结果是:lao wang python
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template