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)
相关推荐
yiangL_6 小时前
Python 学习笔记:递归、turtle绘图、字符串与函数
笔记·python·学习
人生!?7 小时前
Linux 从入门到进阶 | 基础语法
linux·笔记·教程
优化Henry8 小时前
LTE 站点 S1 链路反复闪断导致小区频闪退服故障排查
运维·网络·学习·信息与通信·tdd
β添砖java13 小时前
Transformer大白话学习笔记
笔记·学习·transformer
希和202713 小时前
代码小白笔记:蓝桥杯彩灯控制代码逐段讲解
笔记·mongodb·蓝桥杯
希和202714 小时前
江科大 51 单片机课程笔记:XPT2046 触摸/AD 采集与 LCD1602 显示
笔记·单片机·mongodb
kevin_org17 小时前
LangChain入门学习(四)
python·学习·langchain·fastapi
小七在进步1 天前
string的实现(1)
c++·笔记·visual studio
瑞克-桑切斯1 天前
Kubernetes 1.28 保姆级新手学习教程
运维·学习·docker·云原生·容器·kubernetes
保利威视频SaaS小张1 天前
企业直播接入笔记 12|企业内训直播怎么做签到和学时统计,防挂机这件事比想象中难
java·前端·数据库·笔记·视频云·polvy·polyv