python的join()函数

def join(self, iterable): # real signature unknown; restored from __doc__
"""
S.join(iterable) -> str

Return a string which is the concatenation of the strings in the
iterable. The separator between elements is S.
"""

上面是库函数的定义:可以看到join()函数的参数要求是一个可迭代对象,比如说:

1.字符串

2.列表

3.元组

join()函数返回一个字符串,这个字符串是可迭代对象(即它的参数)中各个元素的结合,这个结合是以字符S为分隔符的。

猜你喜欢

转载自www.cnblogs.com/yibeimingyue/p/10051024.html