python统计英文文章字符串中字符串_python字符串操作、文件操作,英文词频统计预处理...

deffunction5():

str1="""I'm a big big girl !

In a big big world !

It's not a big big thing if you leave me.

But I do do feel.

That I too too will miss you much.

Miss you much !

I can see the first leaf falling.

It's all yellow and nice.

It's so very cold outside.

Like the way I'm feeling inside.

I'm a big big girl !

In a big big world !

It's not a big big thing if you leave me.

But I do do feel.

That I too too will miss you much.

Miss you much !

Outside it's now raining.

And tears are falling from my eyes.

Why did it have to happen ?

Why did it all have to end ?

I'm a big big girl !

In a big big world !

It's not a big big thing if you leave me.

But I do do feel.

That I too too will miss you much.

Miss you much !

I have your arms around me ooooh like fire.

But when I open my eyes.

You're gone !

I'm a big big girl !

In a big big world !

It's not a big big thing if you leave me.

But I do do feel.

That I too too will miss you much.

Miss you much !

I'm a big big girl !

In a big big world !

It's not a big big thing if you leave me.

But I do feel that will miss you much !

Miss you so much !"""

#字符

s1 =str1.lower()print(s1)#去掉空格

str1 =str1.lstrip()print(str1)#将歌词的每个单词分隔组成列表形式

print("将歌词的每个单词分隔组成列表形式:")

strList=str1.split()print(strList)#计算单词出现的次数

print("计算单词出现的次数:")

strSet=set(strList)for word instrSet:print(word, strList.count(word))

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值