#-*- coding: utf-8 -*-
"""
Created on Wed Dec 1 23:02:32 2021
@author: XStation
"""
import re
def reFind(filename,suffix):
r_str = r"\d+\.\d+(?=" + suffix + ")"
r = re.search(r_str, filename)
return r.group()
print(reFind("abcd_16.55016GHz-5dBm-209uW(efg)-100Mw-1.5MHz.csv","MHz"))
正则查找字符串中特定后缀(某单位)的数值
最新推荐文章于 2023-12-16 13:53:53 发布