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)
相关推荐
千逐681 小时前
《鸿蒙备忘录:基于 Flutter for OpenHarmony 的极简本地笔记应用全实现》
笔记·flutter·harmonyos
学编程的闹钟1 小时前
107【php手册】
学习
冷雨夜中漫步8 小时前
Python快速入门(6)——for/if/while语句
开发语言·经验分享·笔记·python
盐焗西兰花10 小时前
鸿蒙学习实战之路-Reader Kit修改翻页方式字体大小及行间距最佳实践
学习·华为·harmonyos
QiZhang | UESTC10 小时前
学习日记day76
学习
久邦科技10 小时前
20个免费电子书下载网站,实现电子书自由(2025持续更新)
学习
Gain_chance10 小时前
34-学习笔记尚硅谷数仓搭建-DWS层最近一日汇总表建表语句汇总
数据仓库·hive·笔记·学习·datagrip
Gain_chance12 小时前
36-学习笔记尚硅谷数仓搭建-DWS层数据装载脚本
大数据·数据仓库·笔记·学习
肖永威12 小时前
macOS环境安装/卸载python实践笔记
笔记·python·macos
XH华12 小时前
备战蓝桥杯,第九章:结构体和类
学习·蓝桥杯