码迷,mamicode.com
首页 > 其他好文 > 详细

英文词频统计预备,组合数据类型练习

时间:2017-09-20 22:07:29      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:bsp   index   数据类型   sed   one   http   组合数   png   logs   

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.

列表里面的数据是可变的,可增删改插。

元组里面的数据是不可变的,只可增,不可删改

 

英文词频统计预备,组合数据类型练习

标签:bsp   index   数据类型   sed   one   http   组合数   png   logs   

原文地址:http://www.cnblogs.com/zheng01/p/7565058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!