>>> tup = ('a', 'b', 'c', 'd', 'g', 'x', 'r', 'e')
>>> ''.join(tup)
'abcdgxre'
>>>
>>> help(str.join)
Help on method_descriptor:
join(...)
S.join(iterable) -> str
Return a string which is the concatenation of the strings in the
iterable. The separator between elements is S.
>>>
使用^{} :
这是有效的:
它将产生:
也可以使用逗号之类的分隔符生成:
通过使用:
这里有一个使用join的简单方法。
相关问题 更多 >
编程相关推荐