人生总有一段时光是你一直在努力,但是默默无为没有任何回报和结果,我是王大毛~
练习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