importre
list = re.findall('SF:((/\w*)*.c$)','SF:/x/eng/rlse/DOT/devN_170820_0500/zephyr/src/libzapid/https_util.c')
print(list)
[('/x/eng/rlse/DOT/devN_170820_0500/zephyr/src/libzapid/https_util.c', '/https_util')]
但我只需要:
/x/eng/rlse/DOT/devN_170820_0500/zephyr/src/libzapid/https_util.c
答案 0 :(得分:0)
在这种情况下,您可以使用搜索获取相应的组,而不是使用findall,如下所示
import re
list = re.search('SF:((/\w*)*.c$)','SF:/x/eng/rlse/DOT/devN_170820_0500/zephyr/src/libzapid/https_util.c')
print(list.group(1))