python正则表达式,怎么提取列表中带有指定字符的字符串?

2024-11-02 08:58:21
推荐回答(2个)
回答1:

Alist=['A_rig','B_obj','F_rig','H_obj','T_rig',]
B=[]
for each in Alist:
if 'obj' in each:
B.append(each)
print(B)

回答2:

List2=[i for i in list if i.endswith(“.obj”)]