import re
p = re.compile(r'\d+')
print p.findall('one1two2three3four4')
print p.findall('one1two2three3four4')[0:2]
### output ###
# ['1', '2', '3', '4']
# ['1', '2']
你可以用切片操作返回来处理findall返回的结果来达到你的目的
or
import re
count = 0
# The end point number
endpoint = 2
p = re.compile(r'\d+')
for m in p.finditer('one1two2three3four4'):
count += 1
if count > endpoint: break
print m.group()
### output ###
# 1 2
你可以用切片操作
返回来处理findall
返回的结果来达到你的目的or