runs of consecutive whitespace are regarded as a single separator, and the result will contain no empty strings at the start or end if the string has leading or trailing whitespace. Consequently, splitting an empty string or a string consisting of just whitespace with a None separator returns [].
For example, ' 1 2 3 '.split() returns ['1', '2', '3']
Python的^{} 对于默认分隔符有一些特殊的行为:
在Scala中完全匹配的最简单方法可能如下:
另一种方法是预先
^{pr2}$trim()
字符串:但这与Python对于空字符串的行为不同:
在Scala中,空字符串的
split()
返回一个包含one元素的数组,但在Python中,结果是一个包含零元素的列表。在相关问题 更多 >
编程相关推荐