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)
相关推荐
sharemylove9 小时前
Java集合框架全面详解
java·开发语言·经验分享·笔记·学习
whyTeaFo10 小时前
GAMES202: Lecture 3: Real-Time Shadows 1 ppt笔记
笔记
摇滚侠11 小时前
《On Java 中文版 基础卷》阅读笔记 内部类 20
java·笔记·python
旖旎夜光16 小时前
LeetCode 493: 翻转对 (归并排序) —— 题解
c++·笔记·学习·算法·leetcode·排序算法
吃我一窝jio16 小时前
Java IO流核心分类与应用
java·开发语言·笔记
Uio24120 小时前
Java HashMap 底层原理详解(JDK1.8 优化、哈希冲突、红黑树、面试必问)
笔记
inferno20 小时前
Java正则表达式学习笔记
java·笔记·学习·正则表达式
小李不想当小白20 小时前
HAL库之中断(STM32 HAL库学习笔记)
笔记·stm32·单片机·嵌入式硬件·学习·嵌入式
Uio24121 小时前
Java集合:ArrayList与LinkedList核心对比(实战+源码要点)
笔记
艾莉丝努力练剑1 天前
【AI大模型接入SDK】项目总结
java·开发语言·前端·c++·人工智能·学习·架构