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)
相关推荐
yi01113 分钟前
LeetCode 15:三数之和|排序 + 双指针,如何避免重复答案?
笔记·python·算法·leetcode·双指针
北风toto23 分钟前
数据库笔记:Armstrong 公理系统与集合论的深度辨析
数据库·笔记
EasyBr指纹浏览器24 分钟前
我的开源项目:小红书笔记归档,把来源和缺项一起留下
笔记·小红书·开源工具·素材管理·内容归档
海海不掉头发26 分钟前
图论及其应用_课堂笔记整理_CSDN博客
笔记·图论
志尊宝30 分钟前
Vue3 零基础每日笔记(075):图片懒加载与骨架屏
javascript·vue.js·笔记
lvqinglou37 分钟前
学习Sql-part1 for婷姐
sql·学习·性能优化
会博通·代码搬运工1 小时前
家装数字化交付笔记:图纸归档、工地采集与档案系统对接的工程实践
笔记·数字化转型·档案管理系统·业务档案系统·家装数字化
Code_Solitude1 小时前
高数第一章函数笔记(原稿手写+AI识别优化)
人工智能·笔记
扶风ff2 小时前
练题簿在线免费刷题:创建个人任务,把刷题、听题和模考目标放到每天的学习中
开发语言·javascript·学习·小程序
imDwAaY2 小时前
MCP 到底是什么?大模型如何连接外部工具与数据?
笔记