【发布时间】:2018-01-31 17:42:31
【问题描述】:
我是一名 Python 学习者。我想使用 python re.split() 将字符串拆分为单个字符,但我不想拆分数字。
Example: s = "100,[+split"
The result should be ["100", ",", "[", "+", "s", "p", "l", "i", "t"]
我尝试使用re.split(r'[A-Za-z]+|\d+', s) 和re.findall(r'[0-9]+]|\d+', s),但我真的不擅长使用这些方法。有人能帮我吗?非常感谢。
【问题讨论】:
标签: python string split digits