Python正则表达式查找6或7位数之间的所有数字

Pre*_*ors 2 python regex

我正在使用这个正则表达式使用python中的re模块并获得此结果:

In [156]: re.findall(r'.*\D(\d{6,7})\D.*', ' f123456 f1234567 ')
Out[156]: ['1234567']
Run Code Online (Sandbox Code Playgroud)

...但我想要这个结果:

Out[156]: ['123456', '1234567']
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何形成这个正则表达式.你能帮忙吗?

use*_*028 8

简化正则表达式

In [5]: re.findall(r'\d{6,7}', ' f123456 f1234567 ')
Out[5]: ['123456', '1234567']
Run Code Online (Sandbox Code Playgroud)