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)

  • 相关阅读:
    js 多媒体文件(图片,表格 等) 下载方法
    CentOS7 + asp.net core 3.1 + mysql 8 配置备忘
    项目管理平台参考设计
    golang 使用rate实现redis qps令牌桶限流
    golang执行命令实时输出(协程通过channel更新数据到主进程)
    go-chart go后端生成图表base64
    go-chart go后端生成图表base64
    golang OOM分析
    Golang xorm time自定义解析
    python 多线程
  • 原文地址:https://www.cnblogs.com/ben-9527/p/8649667.html
Copyright © 2011-2022 走看看