a = list('nihao') # 列表的遍历
print(a)
for i in a:
print(i)
b = tuple('12323') # 元组的遍历
print(b)
for i in b:
print(i)
c = set('kjkjhg') # 集合的遍历
print(c)
for i in c:
print(i)
d = {'v': 44, 'c': 233, 'q': 67} # 字典的遍历
print(d)
for i in d:
print(i, d[i])
![]()
noStr = '''Beautiful girls all over the world.
I could be chasing but my time will be wasted.
They got nothin' on you baby.
Nothin' on you baby.
They might say hi and I might say hey.
But you shouldn't worry about what they say.
Coz they got nothin' on you baby.
Nothin' on you baby.
I know you feel where I'm coming from.
So baby regardless of the things in my past everything I've done.
Cause you and I know it was just for fun,
I was on the carrousel I just spun around.
With no direction, no intentions
It all ended.
It's so much nonsense,
it's on my conscience
I'm thinking "maybe I should get it out"
And I don't wanna sound redundant
But I was wondering,
if there was something that you wanna know
But never mind that,
we should let it go
Coz we don't wanna be a T.V. episode
And all the bad thoughts,
just let em go, go, go
Beautiful girls all over the world.
I could be chasing but my time will be wasted.
They got nothin' on you baby.
Nothin' on you baby.
They might say hi and I might say hey.
But you shouldn't worry about what they say.
Coz they got nothin' on you baby.
Nothin' on you baby.
I know you feel where I'm coming from.
So baby regardless of the things in my past everything I've done.
Cause you and I know it was just for fun,
I was on the carrousel I just spun around.
With no direction, no intentions.
It all ended.
It's so much nonsense,
it's on my conscience
I'm thinking "maybe I should get it out"
And I don't wanna sound redundant
But I was wondering,'''
noStr = noStr.lower()#大小写转换
for i in ''',.!?''':
noStr=noStr.replace(i,' ')#空格代替符号
noStr1 = noStr.split()#出去两边空格
result = {}
for word in set(noStr1):
result[word] = noStr1.count(word)
print(result)