【发布时间】:2018-12-22 18:56:01
【问题描述】:
我希望将以下语料库拆分为多个部分:
corpus = '1 Write short notes on the anatomy of the Circle of Willis including normal variants. 2 Write short notes on the anatomy of the radiological spaces of the orbit excluding the eyeball. 3 Write short notes on the anatomy of the axis (C2 vertebra). 4 Write short notes on the anatomy of the corpus callosum. 5 Write short notes on the anatomy of the posterior division of the internal iliac artery 6 Write short notes on the anal canal including sphincters.
'
如下:
['Write short notes on the anatomy of the Circle of Willis including normal variants.', 'Write short notes on the anatomy of the radiological spaces of the orbit excluding the eyeball.', 'Write short notes on the anatomy of the axis (C2 vertebra).', 'Write short notes on the anatomy of the posterior division of the internal iliac artery', 'Write short notes on the anal canal including sphincters.']
我写了这个,但不起作用:
for i in [int(s) for s in corpus.split() if s.isdigit()]:
answer = corpus.split(str(i))
print(answer)
我能做什么?
【问题讨论】:
-
“它不起作用”可能是一个正确的描述,但如何它不起作用?
-
如果我知道 - 我不会问你...
-
但是您确实知道运行它时会发生什么。它会给出错误吗?它会打印出垃圾吗?你的电脑关机了吗?