我正在尝试根据URL中的单词筛选URL的列表。在
例如,如果URL的任何部分包含/thema/
或{},则应该删除它。在
样品清单:
p = [['www.sample.de/fl/autor/xxx',
'www.sample.de/fl/autor/xxx',
'www.sample.de/fl/autor/xxx',],
['www.temp.de/thema/xxx',
'www.temp.de/thema/xxx',]
]
我的代码:
^{pr2}$
但是,这不会过滤任何内容。在
如何正确地执行此操作?在
Tags:
您应该使用标志来执行此操作:
如果在列表理解中找到任何筛选器,则可以通过删除url在其中使用
any()
:使用正则表达式。在
例如:
按注释编辑
^{pr2}$相关问题 更多 >
编程相关推荐