python删除列表中字符串_从列表中删除与子字符串匹配的项目的最快方法-Python...

在列表中删除与集合中的子字符串匹配的项目的最快方法是什么?

例如,

the_list =

['Donald John Trump (born June 14, 1946) is an American businessman, television personality',

'and since June 2015, a candidate for the Republican nomination for President of the United States in the 2016 election.',

'He is the chairman and president of The Trump Organization and the founder of Trump Entertainment Resorts.',

'Trumps career',

'branding efforts',

'personal life',

'and outspoken manner have made him a celebrity.',

'Trump is a native of New York City and a son of Fred Trump, who inspired him to enter real estate development.',

'While still attending college he worked for his fathers firm',

'Elizabeth Trump & Son. Upon graduating in 1968 he joined the company',

'and in 1971 was given control, renaming the company The Trump Organization.',

'Since then he has built hotels',

'casinos',

'golf courses',

'and other properties',

'many of which bear his name. He is a major figure in the American business scene and has received prominent media exposure']

该列表实际上比这个列表(几百万个字符串元素)长得多,我想删除包含集合中所有字符串的任何元素,例如,

{"Donald Trump", "Trump Organization","Donald J. Trump", "D.J. Trump", "dump", "dd"}

最快的方法是什么?循环最快吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值