我正在使用以下
clear= join(('string', seed ,'Aviesta'));
它给了我错误:未定义全局名称“加入”。请帮助!
join
是一个str
方法,你需要在一个str
实例上调用它:
In [31]: str.join??
Type: method_descriptor
String Form:<method 'join' of 'str' objects>
Namespace: Python builtin
Docstring:
S.join(iterable) -> string
Return a string which is the concatenation of the strings in the
iterable. The separator between elements is S.
In [32]: ''.join(('string', 'seed' ,'Aviesta'))
Out[32]: 'stringseedAviesta'
In [33]: '_'.join(('string', 'seed' ,'Aviesta'))
Out[33]: 'string_seed_Aviesta'