@Quinquer :《银河之歌》演唱者:史蒂芬·霍金
歌词:
Whenever life gets you down, Mrs. Brown
当生活让你感到万分沮丧的时候,布朗太太
And things seem hard or tough
日子过得粗鄙不堪,好像陷入了困境
And people are stupid obnoxious or daft
人们看上去都蠢极了,举止间的癫狂真是令人作呕
And you feel that
@Quinquer :《银河之歌》演唱者:史蒂芬·霍金
歌词:
Whenever life gets you down, Mrs. Brown
当生活让你感到万分沮丧的时候,布朗太太
And things seem hard or tough
日子过得粗鄙不堪,好像陷入了困境
And people are stupid obnoxious or daft
人们看上去都蠢极了,举止间的癫狂真是令人作呕
And you feel that
Python求数组中连续出现某元素的最大次数
import itertools
a = ['b','b','b','a','b','a','a']
print (max([len(list(v)) for k,v in itertools.groupby(a) if k=='a']))
不指定元素的话就把if条件去掉