import re
entity_startindex = [i.start() for i in re.finditer(temp_label[0], sentecen)]
其中temp_label[0]是子字符串,sentecen是待查找的字符串,如果多次出现都会查找到首位置的index下标
import re
entity_startindex = [i.start() for i in re.finditer(temp_label[0], sentecen)]
其中temp_label[0]是子字符串,sentecen是待查找的字符串,如果多次出现都会查找到首位置的index下标