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)
相关推荐
摇滚侠2 小时前
如何选择 nodejs 版本,nodejs 版本号详解
学习
醇氧2 小时前
【学习】IP地址:数字世界的“门牌号”怎么读?
网络协议·学习·tcp/ip
Hello_Embed3 小时前
嵌入式上位机开发入门(三):TCP 编程 —— Server 端实现
笔记·单片机·网络协议·tcp/ip·嵌入式
talen_hx2963 小时前
《零基础入门Spark》学习笔记 Day 11
笔记·学习·spark
ZhiqianXia4 小时前
gem5 模拟器学习笔记(1):核心术语整理
笔记·学习
GHL2842710905 小时前
MCP学习
学习·ai
凌波粒5 小时前
D2L学习笔记:安装、张量与数据处理
笔记·python·学习·pandas
taoqick6 小时前
FIPO粗读笔记
笔记
chools6 小时前
Java后端拥抱AI开发之个人学习路线 - - Spring AI【第一期】
java·人工智能·学习·spring·ai