标签:多少 distance lower replace span 大写 images ima 字符
下载一首英文的歌词或文章,将所有大写转换为小写,,将所有其他做分隔符(,.?!)替换为空格,并统计某些单词出现的次数。
s=‘‘‘every night in my dreams i see you, i feel you, that is how i know you go on far across the distance and spaces between us you have come to show you go on near, far, wherever you are i believe that the heart does go on once more you open the door and you‘re here in my heart and my heart will go on and on love can touch us one time and last for a lifetime and never let go till we‘re one love was when i loved you one true time i hold to in my life we‘ll always go on near, far, wherever you are i believe that the heart does go on once more you open the door and you‘re here in my heart and my heart will go on and on there is some love that will not go away you‘re here, there‘s nothing i fear, and i know that my heart will go on we‘ll stay forever this way you are safe in my heart and my heart will go on and on‘‘‘ s=s.lower() s.replace(‘,‘,‘ ‘) words=s.split(‘ ‘) print(words) print(s.count(‘go‘))
由字符串创建一个作业评分列表,做增删改查询统计遍历操作。
全部改为数值型
查询第一个3分的下标
1分的同学有多少个,3分的同学有多少个
s=[‘1‘,‘2‘,‘3‘,‘2‘,‘2‘,‘1‘] print(type(s)) print(s) print(s[0]) s[1]=‘3‘ print(s) print(len(s)) s.append(‘2‘) print(s) print(max(s)) s.insert(0,‘3‘) print(s) print(list(s)) d=list(s) print(d) b=list(‘123221‘) print(b) f=(‘1‘,‘2‘,‘3‘,‘2‘,‘2‘,‘1‘) print(f) print(f.count(‘1‘)) print(f.count(‘3‘))
标签:多少 distance lower replace span 大写 images ima 字符
原文地址:http://www.cnblogs.com/caoxinwen092/p/7574080.html