import sys
import os
import re
if __name__ == '__main__':
SEARCH_PAT = re.compile(r'iops\s*=\s*(\d+)')
src_line = 'io=8192.0MB, bw=24407KB/s, iops=6101 , runt=343698msec'
pat_search = SEARCH_PAT.search(src_line)
if pat_search != None:
print pat_search.group(1)
直接find就行了吧
a="io=8192.0MB, bw=24407KB/s, iops=6101 , runt=343698msec"
a[a.find('iops=')+5:a.find(',', a.find('iops'))]