【发布时间】:2017-03-08 19:32:47
【问题描述】:
这是我的代码。
SENTENCE = "He sad might have lung cancer. It’s just a rumor."
sent=(sent_tokenize(SENTENCE))
输出是
['He sad might have lung cancer.', 'It’s just a rumor.']
我想得到这个数组
['He sad might have lung cancer.']
['It’s just a rumor.']
他们有什么办法吗?如果有,怎么办?
【问题讨论】:
-
嗯,您是否有理由希望每个字符串都在列表中?似乎没有多大意义..除非我错过了什么。
-
[[x] for x in ['He sad might have lung cancer.', 'It’s just a rumor.']]