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

相关推荐
DFT计算杂谈23 分钟前
自动化脚本一键绘制三元化合物相图
java·运维·服务器·开发语言·前端·python·自动化
EW Frontier1 小时前
6G ISAC新范式:基于智能漏波天线的Wi‑Fi通感一体化系统设计与实测【附MATLAB+python代码】
开发语言·python·matlab·music·isac·doa·wi‑fi
姚青&1 小时前
测试技术体系
java·python
楼田莉子1 小时前
Linux网络:NAT_代理
linux·运维·服务器·开发语言·c++·后端
froginwe111 小时前
jEasyUI 创建基础树形网格
开发语言
易标AI1 小时前
标书智能体(五)——如何让弱模型也能稳定输出复杂json
人工智能·python·提示词·智能体·招投标
Victory_20252 小时前
c#定时器顺序控制写法
开发语言·c#·c#顺序控制+定时器
Cyber4K2 小时前
【Python专项】Nginx访问日志分析时间范围处理示例
开发语言·python·nginx
中犇科技2 小时前
郑州无代码APP开发公司哪家好呢?推荐
开发语言
周末也要写八哥2 小时前
代码中的注释的重要性(二)
开发语言·python