书生大模型实战营第三期——入门岛——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笔记

相关推荐
笑衬人心。2 分钟前
Ubuntu 22.04 修改默认 Python 版本为 Python3 笔记
笔记·python·ubuntu
蛋仔聊测试15 分钟前
Playwright 中 Page 对象的常用方法详解
python
醇醛酸醚酮酯23 分钟前
Qt项目锻炼——TODO清单(二)
开发语言·数据库·qt
前端付豪27 分钟前
17、自动化才是正义:用 Python 接管你的日常琐事
后端·python
jioulongzi29 分钟前
记录一次莫名奇妙的跨域502(badgateway)错误
开发语言·python
破无差1 小时前
python实现简单的地图绘制与标记20250705
python
向阳@向远方1 小时前
第二章 简单程序设计
开发语言·c++·算法
喜欢吃豆1 小时前
目前最火的agent方向-A2A快速实战构建(二): AutoGen模型集成指南:从OpenAI到本地部署的全场景LLM解决方案
后端·python·深度学习·flask·大模型
Mr_Xuhhh2 小时前
信号与槽的总结
java·开发语言·数据库·c++·qt·系统架构
纳兰青华2 小时前
bean注入的过程中,Property of ‘java.util.ArrayList‘ type cannot be injected by ‘List‘
java·开发语言·spring·list