2024-09-28 21:39:01 发布
网友
我有一个以下格式的文本文件,其中某些段落用一组星号标记,如下所示:
This 'impossibility' is the inspiration of his work. ******** There are no methods that comprehend his subject.
使用Python,如何仅提取星号集后面的段落
您可以这样做:
string = "******** There are no methods that comprehend his subject." paragraph = string[string.find("********")+8:]
where string.find在段落中查找特定字符串的索引,并向其中添加8,因为这是有多少个星号
您可以这样做:
where string.find在段落中查找特定字符串的索引,并向其中添加8,因为这是有多少个星号
相关问题 更多 >
编程相关推荐