英文词频统计预备,组合数据类型练习
Posted 会搓火球的单身gou
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了英文词频统计预备,组合数据类型练习相关的知识,希望对你有一定的参考价值。
1.
s=\'\'\'We don\'t talk anymore
We don\'t talk anymore
We don\'t talk anymore
Like we used to do
We don\'t laugh anymore
What was all of it for ?
We don\'t talk anymore
Like we used to do
I just heard you ( ya ) found the one you\'ve been lookin\'
The one you been looking for
I wish i would\'ve konwn that wasn\'t me
Cause even after all this time i still wonder
Why i can\'t move on ?
Just the way you dance so easliy
Don\'t wanna know
The kinda dress you\'re wearin\' tonight
If he\'s holdin\' onto you so tight
The way i did before
I overdosed
Should\'ve known your love was game
Now I can\'t get\'cha out of my brain
Ooh it\'s such a shame
We don\'t talk anymore
We don\'t talk anymore
We don\'t talk anymore
Like we used to do
We don\'t laugh anymore
What was all of it for ?
We don\'t talk anymore
Like we used to do\'\'\'
s=s.lower()
for i in \',.?\':
s=s.replace(i,\' \')
print(s.split(\' \'))
print(s.count(\'talk\'))
print(s.count(\'anymore\'))
2.
ls=list(\'2132132132\')
for i in range(len(ls)):
ls[i]=int(ls[i])
print(ls)
ls.append(5)
print(ls)
ls.remove(5)
print(ls)
ls.sort()
print(ls)
print(ls.count(1))
print(ls.count(3))
print(ls.index(3))
3.
列表里面的数据是可变的,可增删改插。
元组里面的数据是不可变的,只可增,不可删改
以上是关于英文词频统计预备,组合数据类型练习的主要内容,如果未能解决你的问题,请参考以下文章