我有数据帧。df[0]包含
Eukariota|Organisme eukariotik (hewan, tumbuhan, fungi, dan protista) menyimpan kebanyakan DNA-nya dalam inti sel dan sebagian kecil sisanya dalam organel seperti mitokondria ataupun kloroplas. < ref > {{cite book|last = Russell|first = Peter|title = iGenetics|publisher = Benjamin Cummings|location = New York|year = 2001|isbn = 0-8053-4553-1 }} < /ref >
我想删除:
< ref > {{cite book|last = Russell|first = Peter|title = iGenetics|publisher = Benjamin Cummings|location = New York|year = 2001|isbn = 0-8053-4553-1 }} < /ref >
怎么做?谢谢
作为示例数据帧:
使用字符串替换并传递
regex = True
。如果需要替换其他模式,请使用|
符号来额外添加正则表达式模式我会用正则表达式
这是用于您提到的案例的正则表达式:
(\<\sref\s\>.*\<\s\/ref\s\>)
您可以使用
re
匹配两个标记之间的所有文本。使用< ref >.*< \/ref >
将匹配两个标记中的任何文本相关问题 更多 >
编程相关推荐