0
我此行如何括號中的搜索字符,搜索一個名爲反向引用的正則表達式蟒蛇
15815 (sh): demand=3000000 boost=1 reason=0 sync=0 need_idle=0 flags=80002 grp=0 best_cpu=6 latency=0
我想用正則表達式的Python,但總是登陸了一個名爲反向引用提取SH和標誌值沒有類型的對象,我該怎麼做?
下面是代碼,我的嘗試:
pattern = re.compile(r"\((?P<thread>.*?)\)*\sflags=(?P<flags>\d+)")
m = pattern.search(str)
m.group()
'(sh): demand=3000000 boost=1 reason=0 sync=0 need_idle=0 flags=80002'
非常感謝!這是我正在尋找的。 – R2D2