手册中关于split()用法如下: str.split(sep=None, maxsplit=-1) Return a list of the words in the string, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done (thus, the list will have at most maxsplit+1 elements). If maxs…
一个是分割,一个是连接. 惯例,先看内部帮助文档 Help on method_descriptor: join(...) S.join(iterable) -> string Return a string which is the concatenation of the strings in the iterable. The separator between elements is S. (END) 将可迭代对象(包含的应该是str类型的,不然会报错)连接起来, 返回值是str,用法如…
Split函数,用来返回一个下标从零开始的一维数组,如下举例说明 1.split(' '),''号中间是空格 def break_words(stuff): """This function will break up words for us""" words=stuff.split(' ') return words 返回的words应该是This function will break up words for us 2.…