书生大模型实战营第三期——入门岛——python基础知识

第二关:python基础知识

任务如下:

任务描述
闯关任务 Python实现wordcount
闯关任务 Vscode连接InternStudio debug笔记

1 Vscode连接InternStudio

见第一关教程中vscode远程连接部分。

书生大模型实战营第三期------入门岛------Linux基础知识-CSDN博客

2 Python实现wordcount

python 复制代码
def word_count(text):
    import re
    words = re.findall(r'\b\w+\b', text.lower())
    word_dict = {}
    for word in words:
        if word in word_dict:
            word_dict[word] += 1
        else:
            word_dict[word] = 1
    return word_dict

input_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."""

output = word_count(input_text)
print(output)

3 Vscode连接InternStudio debug笔记

相关推荐
u0109147601 分钟前
mysql如何配置监听IP_mysql bind-address多地址设置
jvm·数据库·python
a9511416428 分钟前
如何配置RMAN使用第三方备份软件接口_NetBackup或Commvault的MML层整合
jvm·数据库·python
踏着七彩祥云的小丑12 分钟前
Python——requests——响应码
python
sonnet-102914 分钟前
函数式接口和方法引用
java·开发语言·笔记
Ulyanov15 分钟前
Apache Kafka在雷达仿真数据流处理中的应用
分布式·python·kafka·apache·雷达电子战
Bat U18 分钟前
JavaEE|多线程(二)
java·开发语言
u01091476020 分钟前
CSS如何处理超长文本换行问题_结合word-wrap属性
jvm·数据库·python
电化学仪器白超24 分钟前
小乌龟Git全程图形化操作指南:嵌入式本地版本管理与Gitee私有云备份实战
git·python·单片机·嵌入式硬件·物联网·gitee·自动化
2401_8371638925 分钟前
如何在 Go 中正确解析带命名空间的 SOAP 响应
jvm·数据库·python
_Evan_Yao25 分钟前
RAG中的“Chunk”艺术:我试过10种切分策略后总结的结论
java·人工智能·后端·python·软件工程