1. re模块是正则表达式模块,re模块中包含一个重要函数是compile(pattern [, flags]) ,该函数根据包含的正则表达式的字符串创建模式对象.可以实现更有效率的匹配. import re msgidRegex = re.compile(r',(\d)+,') mo = msgidRegex.search(rec_data) return mo.group() 看下rec_data的数据 rec_data="+MIPLOBSERVE:0,68220,1,3303,0,-1&q…