【发布时间】:2021-10-01 19:53:55
【问题描述】:
我试图将我的句子拆分为“和”,但有些结果看起来像这样
我的代码
string = 'I am handling it because it is difficult and confusing'
string.split('and')
结果
['I am h', 'ling it because it is difficult ', ' confusing']
我正在努力解决这个问题。我该怎么做?
['I am handling it because it is difficult ', ' confusing']
【问题讨论】:
-
你可以在
' and '(带空格)上拆分 -
这能回答你的问题吗? Split string based on regex
标签: python-3.x