python查找重复文本字段_Python实现在字符串中查找重复字段(共享Python算法),python,一段,找出,的,分享...

人生总有一段时光是你一直在努力,但是默默无为没有任何回报和结果,我是王大毛~

练习python中自带函数的使用,快速掌握python数据类型的各个内置方法:

今天分享一段简单的实现在一段字符串中,找出重复的字段,如有更好的方法,欢迎评论区留言。

用到的内置方法有:

str.split:分割字符串

set.(list): 找出list中重复的元素,得到的结果以没有key,只有value的字典类型;

count(list.obj):count() 方法用于统计某个元素在列表中出现的次数。

str_1 = '''It was designed by the prestigious architect Zaha Hadid and has a wave-like roof that is 160 metres long.

Today's special events are designed to arouse interest in the Olympics around the world and to encourage British fans too.

Many failed to get Olympic tickets in the recent sales process.

According to a new survey for the BBC, 53% of Londoners think the process was "not fair".

But the same survey found support is growing for London 2012. Of the 1,000 people surveyed, 73% said they ba

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值