主页
Python
Python 正则表达式
demo_regex_split2
运行 ❯
×
更改方向
保存代码
更改主题
import re #Split the string at the first white-space character: txt = "The rain in Spain" x = re.split("\s", txt, 1) print(x)
['The', 'rain in Spain']