InternLM学习笔记

入门岛

1. Linux基础知识





2. Python 基础知识

python 复制代码
from collections import Counter


text = """
Got this panda plush toy for my daughter's birthday,
who loves it and takes it everywhere. It's soft and
super cute, and its face has a friendly look. It's
a bit small for what I paid though. I think there
might be other options that are bigger for the
same price. It arrived a day earlier than expected,
so I got to play with it myself before I gave it
to her.
"""


def wordcount(text: str):
    text = text.lower().replace('.', '').replace(',', '').replace('\n', ' ')
    words = [word[:-2] if word.endswith("'s") else word for word in text.split(' ') if word]
    return dict(Counter(words))


if __name__ == '__main__':
    res = wordcount(text)
    print(res)
相关推荐
M78佐菲1 小时前
51单片机学习笔记:ds18b20要点整理
linux·笔记·嵌入式硬件·学习·51单片机
高亦真2 小时前
今天是学习嵌入式的第37天
linux·学习·算法
蒸蒸yyyyzwd3 小时前
从面经中学到的三件事
c++·笔记
泡泡鱼(敲代码中)4 小时前
Python 字符串 str 完整学习笔记
python·学习
IT小白杨5 小时前
社媒多账号运营的环境隔离:一张图谱模型,解释清“为什么换IP还是被连坐“
经验分享·笔记·矩阵·指纹浏览器
kyrie_sakura6 小时前
python学习笔记15 -- Anaconda,Jupyter,numpy
python·学习·jupyter·numpy
PC2005-cloud8 小时前
Rust学习笔记:控制流——if、loop、while、for与match
笔记·学习·rust
彧azz8 小时前
DFS与BFS:图遍历的两大核心算法
数据结构·学习·算法·深度优先·广度优先
IT笔记9 小时前
Rust 迭代器多级链式调用执行顺序笔记
开发语言·笔记·rust
kyrie_sakura9 小时前
python学习笔记14 -- FastAPI
笔记·python·学习·fastapi