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

1.

Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> s= '''I'm gonna pop some tags
Only got twenty dollars in my pocket
I, I, I'm hunting
Looking for a come up
This is fuckin awesome
Walk in the club like what up?
I got a big cock
Nah, Im just pumped up, bought some shit from the thrift shop
Ice on the fringe is so damn frosty
People like Damn, thats a cold ass honkey
Rolling in hella, headed to the mezzanine
Dressed in all pink except my gator shoes, those are green
Draped in a leopard mink, girl standing next to me
Probably shoulda washed this, smells like R.Kelly sheets, piss
But shit, it was 99 cents, buy it, cop it and washing it
Bout to go and get some compliments, passing up on those moccasins
Someone else has been walking in, bummy and grungy, Fuck it
I am stunting and flossing and saving my money and I am halla happy
Thats a bargain Bitch,
Imma take your grandpa style
Imma take your grandpa style
no for real, ask your grandpa
Can I have his hand-me-downs? (thank you)
Velour jumpsuit and some house slippers,
dookie brown leather jacket that I found digging.
They had a broken keyboard, I bought a broken keyboard
I bought a ski blanket, then I bought a knee board
Hello, hello, my ace man, my Mello
John Wayne aint got nothing on my fringe game, hell no
I could take some Pro Wings, make them cool, sell those
The sneaker heads would be like Ah, he got the Velcros
I'm gonna pop some tags
Only got twenty dollars in my pocket
I, I, I'm hunting
Looking for a come up
This is fuckin awesome
What you know about rocking a wolf on your noggin?
What you knowing about wearing a fur fox skin?
Im digging, Im digging, Im searching right through that luggage
One mans trash, thats another mans come up
Thank your granddad for donating that plaid button up shirt
Cause right now, Im up in her skirt
Im at the Good will, you can find me in the bins
Im that sucker, sucker searching in the section
Your grammy, your aunty, your momma, your mammy
Ill take those flannel zebra jammies
second hand and Ill rock that mother fucker
The built in onsies with the socks on the mother fucker
I hit the party and they stop in that mother fucker
They be like Oh that Gucci, thats hella tight
Im like Yo, thats fifty dollars for a t-shirt
Limited edition, lets do some simple addition
Fifty dollars for a t-shirt, thats just some ignorant bitch shit
I call that getting swindled and pimped, shit
I call that getting tricked by a business, that shirts hella don't
And having the same one as six other people in this club is a hella don't
Peep game, come take a look through my telescope
Trying to get girls from a brand? Man you hella wont, man you hella wont
(little girl) goodwill, be popping tags, yeah-ah-ah
I'm gonna pop some tags
Only got twenty dollars in my pocket
I, I, I'm hunting
Looking for a come up
This is fuckin awesome
I wear your granddad's clothes, I look incredible
Im in this big ass coat from that thrift shop down the road
I wear your granddad's clothes, I look incredible
Im in this big ass coat from that thrift shop down the road
I'm gonna pop some tags
Only got twenty dollars in my pocket
I, I, I'm hunting
Looking for a come up
This is fuckin awesome
(little girl) Is that your Grandma's coat? Hee hee[12] '''>>> s.replace(',,?,!',' ')
"I'm gonna pop some tags\nOnly got twenty dollars in my pocket\nI, I, I'm hunting\nLooking for a come up\nThis is fuckin awesome\nWalk in the club like what up?\nI got a big cock\nNah, Im just pumped up, bought some shit from the thrift shop\nIce on the fringe is so damn frosty\nPeople like Damn, thats a cold ass honkey\nRolling in hella, headed to the mezzanine\nDressed in all pink except my gator shoes, those are green\nDraped in a leopard mink, girl standing next to me\nProbably shoulda washed this, smells like R.Kelly sheets, piss\nBut shit, it was 99 cents, buy it, cop it and washing it\nBout to go and get some compliments, passing up on those moccasins\nSomeone else has been walking in, bummy and grungy, Fuck it\nI am stunting and flossing and saving my money and I am halla happy\nThats a bargain Bitch,\nImma take your grandpa style\nImma take your grandpa style\nno for real, ask your grandpa\nCan I have his hand-me-downs? (thank you)\nVelour jumpsuit and some house slippers,\ndookie brown leather jacket that I found digging.\nThey had a broken keyboard, I bought a broken keyboard\nI bought a ski blanket, then I bought a knee board\nHello, hello, my ace man, my Mello\nJohn Wayne aint got nothing on my fringe game, hell no\nI could take some Pro Wings, make them cool, sell those\nThe sneaker heads would be like Ah, he got the Velcros\nI'm gonna pop some tags\nOnly got twenty dollars in my pocket\nI, I, I'm hunting\nLooking for a come up\nThis is fuckin awesome\nWhat you know about rocking a wolf on your noggin?\nWhat you knowing about wearing a fur fox skin?\nIm digging, Im digging, Im searching right through that luggage\nOne mans trash, thats another mans come up\nThank your granddad for donating that plaid button up shirt\nCause right now, Im up in her skirt\nIm at the Good will, you can find me in the bins\nIm that sucker, sucker searching in the section\nYour grammy, your aunty, your momma, your mammy\nIll take those flannel zebra jammies\nsecond hand and Ill rock that mother fucker\nThe built in onsies with the socks on the mother fucker\nI hit the party and they stop in that mother fucker\nThey be like Oh that Gucci, thats hella tight\nIm like Yo, thats fifty dollars for a t-shirt\nLimited edition, lets do some simple addition\nFifty dollars for a t-shirt, thats just some ignorant bitch shit\nI call that getting swindled and pimped, shit\nI call that getting tricked by a business, that shirts hella don't\nAnd having the same one as six other people in this club is a hella don't\nPeep game, come take a look through my telescope\nTrying to get girls from a brand? Man you hella wont, man you hella wont\n(little girl) goodwill, be popping tags, yeah-ah-ah\nI'm gonna pop some tags\nOnly got twenty dollars in my pocket\nI, I, I'm hunting\nLooking for a come up\nThis is fuckin awesome\nI wear your granddad's clothes, I look incredible\nIm in this big ass coat from that thrift shop down the road\nI wear your granddad's clothes, I look incredible\nIm in this big ass coat from that thrift shop down the road\nI'm gonna pop some tags\nOnly got twenty dollars in my pocket\nI, I, I'm hunting\nLooking for a come up\nThis is fuckin awesome\n(little girl) Is that your Grandma's coat? Hee hee[12] "
>>> s.count('what')
1
>>> s.count('pop')
5
>>> s=s.lower()
>>> print(s)
i'm gonna pop some tags
only got twenty dollars in my pocket
i, i, i'm hunting
looking for a come up
this is fuckin awesome
walk in the club like what up?
i got a big cock
nah, im just pumped up, bought some shit from the thrift shop
ice on the fringe is so damn frosty
people like damn, thats a cold ass honkey
rolling in hella, headed to the mezzanine
dressed in all pink except my gator shoes, those are green
draped in a leopard mink, girl standing next to me
probably shoulda washed this, smells like r.kelly sheets, piss
but shit, it was 99 cents, buy it, cop it and washing it
bout to go and get some compliments, passing up on those moccasins
someone else has been walking in, bummy and grungy, fuck it
i am stunting and flossing and saving my money and i am halla happy
thats a bargain bitch,
imma take your grandpa style
imma take your grandpa style
no for real, ask your grandpa
can i have his hand-me-downs? (thank you)
velour jumpsuit and some house slippers,
dookie brown leather jacket that i found digging.
they had a broken keyboard, i bought a broken keyboard
i bought a ski blanket, then i bought a knee board
hello, hello, my ace man, my mello
john wayne aint got nothing on my fringe game, hell no
i could take some pro wings, make them cool, sell those
the sneaker heads would be like ah, he got the velcros
i'm gonna pop some tags
only got twenty dollars in my pocket
i, i, i'm hunting
looking for a come up
this is fuckin awesome
what you know about rocking a wolf on your noggin?
what you knowing about wearing a fur fox skin?
im digging, im digging, im searching right through that luggage
one mans trash, thats another mans come up
thank your granddad for donating that plaid button up shirt
cause right now, im up in her skirt
im at the good will, you can find me in the bins
im that sucker, sucker searching in the section
your grammy, your aunty, your momma, your mammy
ill take those flannel zebra jammies
second hand and ill rock that mother fucker
the built in onsies with the socks on the mother fucker
i hit the party and they stop in that mother fucker
they be like oh that gucci, thats hella tight
im like yo, thats fifty dollars for a t-shirt
limited edition, lets do some simple addition
fifty dollars for a t-shirt, thats just some ignorant bitch shit
i call that getting swindled and pimped, shit
i call that getting tricked by a business, that shirts hella don't
and having the same one as six other people in this club is a hella don't
peep game, come take a look through my telescope
trying to get girls from a brand? man you hella wont, man you hella wont
(little girl) goodwill, be popping tags, yeah-ah-ah
i'm gonna pop some tags
only got twenty dollars in my pocket
i, i, i'm hunting
looking for a come up
this is fuckin awesome
i wear your granddad's clothes, i look incredible
im in this big ass coat from that thrift shop down the road
i wear your granddad's clothes, i look incredible
im in this big ass coat from that thrift shop down the road
i'm gonna pop some tags
only got twenty dollars in my pocket
i, i, i'm hunting
looking for a come up
this is fuckin awesome
(little girl) is that your grandma's coat? hee hee[12] 

2.字符串的增查删改练习

>>> t=list('123321223213')
>>> t
['1', '2', '3', '3', '2', '1', '2', '2', '3', '2', '1', '3']
>>> t.append(4)
>>> t
['1', '2', '3', '3', '2', '1', '2', '2', '3', '2', '1', '3', 4]
>>> t.pop()
4
>>> t.pop(-1)
'3'
>>> t.count('2')
5
>>> t.insert(2,6)
>>> t
['1', '2', 6, '3', '3', '2', '1', '2', '2', '3', '2', '1']

3.简要描述列表与元组的异同。 

列表是一组可变的数据,可以任意进行增删改的操作,属于可变的数据。

元祖是一组先定义好的数据,不能任意的增删改操作,不可以随意更改,为不可变。

 

posted @ 2017-09-22 16:16  blackboardf  阅读(243)  评论(0编辑  收藏  举报