zoukankan      html  css  js  c++  java
  • 综合练习

    song = '''
       An empty street
    An empty house
    A hole inside my heart
    I'm all alone
    The rooms are getting smaller
    I wonder how
    I wonder why
    I wonder where they are
    The days we had
    The songs we sang together
    Oh yeah
    And oh my love
    I'm holding on forever
    Reaching for a love that seems so far
    So i say a little prayer
    And hope my dreams will take me there
    Where the skies are blue to see you once again, my love
    Over seas and coast to coast
    To find a place i love the most
    Where the fields are green to see you once again, my love
    I try to read
    I go to work
    I'm laughing with my friends
    But i can't stop to keep myself from thinking
    Oh no I wonder how
    I wonder why
    I wonder where they are
    The days we had
    The songs we sang together
    Oh yeah And oh my love
    I'm holding on forever
    Reaching for a love that seems so far Mark:
    To hold you in my arms
    To promise you my love
    To tell you from the heart
    You're all i'm thinking of
    I'm reaching for a love that seems so far 
    So i say a little prayer
    And hope my dreams will take me there
    Where the skies are blue to see you once again, my love
    Over seas and coast to coast
    To find a place i love the most
    Where the fields are green to see you once again,my love
    say a little prayer
    dreams will take me there
    Where the skies are blue to see you once again
     '''
    sep=''',.?!:'-'''
    for c in sep:
        song = song.replace(c,'')
    wordList = song.lower().split()
    
    wordDict={}
    '''wordSet=set(wordList)
    for w in wordSet:
        wordDict[w]=wordList.count(w)
    '''
    for w in wordList:
        wordDict[w]=wordDict.get(w,0)+1
        dictList = list(wordDict.items())
        dictList.sort(key=lambda x:x[1],reverse=True)
    
        for w in dictList:
            print(w)

  • 相关阅读:
    打jar包的命令
    WebServiceWSDLWeb
    linux命令之检测端口是否启用
    mybatis generator 插件安装及使用
    Mybatis 中一对多,多对一的配置
    大数据时代日志分析平台ELK的搭建
    关于RestfulAPI与SpringMVC之间的传值
    linux快速清空文件内容
    Linux之第一个shell命令
    Linux之yum
  • 原文地址:https://www.cnblogs.com/ben-9527/p/8649667.html
Copyright © 2011-2022 走看看