import re
s="""hahah<div class="西游记"><span id='10010'>中国联通</span></div>
<div class="三国杀"><span id='10086'>中国移动</span></div>heheh"""
obj = re.compile(r"""<div class="(?P<class>.*?)"><span id='(?P<id>.*?)'>(?P<lt>.*?)</span></div>""")
result = obj.finditer(s)
for item in result:
print(item.group("id"))