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)
相关推荐
柳鲲鹏9 小时前
内斗学概论:43、平级内斗
笔记
星恒随风11 小时前
MySQL 从零入门(四):表的增删改查与基础查询详解
linux·服务器·数据库·笔记·mysql
li星野11 小时前
相位补偿学习记录:把被颅骨“打乱“的声波重新对齐
学习
Z21-X12 小时前
云原生运维学习笔记:ECShop全链路容器化部署与Docker底层资源隔离深度剖析
运维·笔记·学习·云原生
red_redemption13 小时前
自由学习记录(230)
学习
晓梦林17 小时前
BUUCTF-菜刀流量-MISC-学习笔记
笔记·学习
Godspeed Zhao1 天前
从零开始学AI25——无监督学习之层次聚类
学习·机器学习·聚类
David猪大卫1 天前
【C++修炼】map 和 set 的使用
c语言·开发语言·数据结构·c++·经验分享·笔记·学习
HPtiger1 天前
C++ 入门笔记:从 C 到 C++ 的核心过渡(命名空间、输入输出、缺省参数、重载、引用、内联)
c语言·c++·学习
星恒随风1 天前
MySQL 从零入门(三):表的约束详解
linux·服务器·数据库·笔记·mysql