标签:歌曲 词频统计 sha http 有序 back 不同 img 歌词
song=‘‘‘When I was young I had listen to the radio Waiting for my favorite songs When they played I‘d sing along, It make me smile. Those were such happy times and not so long ago How I wondered where they had gone. But they are back again just like a long lost friend All the songs I love so well. Every shalala every still shines. Every shing-a-ling-a-ling that they are starting to sing so fine‘‘‘ song=song.lower() song=song.replace(‘,‘,‘ ‘) song=song.replace(‘.‘,‘ ‘) song=song.replace(‘-‘,‘ ‘) print(‘long出现的次数:‘,song.count(‘long‘)) print(‘ I 出现的次数:‘,song.count(‘I‘)) newsong=song.split(‘ ‘) print(‘ 改变后的英文歌曲:‘,newsong)
s=list(‘211321323123121233‘) s.append(‘1‘) s.insert(2,‘2‘) s.pop() s.pop(7) print(s) print(‘3分的起始位置是‘,s.index(‘3‘)) print(‘1分的有‘,s.count(‘1‘),‘个‘) print(‘3分的有‘,s.count(‘3‘),‘个‘)
list是一种有序的序列,正向递增、反向递减序列,可以随时添加和删除其中的元素;没有长度限制、元素类型可以不同;
tuple可读取里面的元素,但是不能改变其中的元素。
标签:歌曲 词频统计 sha http 有序 back 不同 img 歌词
原文地址:http://www.cnblogs.com/1996liuda/p/7574356.html