书生大模型实战营闯关2 - Python基础知识

任务一:Python实现wordcount

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):
    import re
    words = re.split(r"[ ,.\n]+", text)
    count_map = {}
    for word in words:
        if not word:
            continue
        simplized = word.lower()
        if simplized in count_map:
            count_map[simplized ] += 1
        else:
            count_map[simplized ] = 1
    return count_map

任务二:Vscode连接InternStudio debug笔记

打开VSCode和开发机,在页面的左侧找到远程选项卡,填写服务器信息

按提示输入密码

等待VSCode连接并自动配置远程开发环境

左下角展示主机名就说明已经连接成功了

在插件中选择安装python的插件到远程机器

创建一个python文件,然后把代码复制进去

接下来的使用过程就和在自己电脑上调试一模一样了

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-21 19:48:01       101 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-21 19:48:01       109 阅读
  3. 在Django里面运行非项目文件

    2024-07-21 19:48:01       87 阅读
  4. Python语言-面向对象

    2024-07-21 19:48:01       96 阅读

热门阅读

  1. [强化学习马里奥 MarioRL]-- 环境ENV 3

    2024-07-21 19:48:01       23 阅读
  2. ubuntu 上安装中文输入法

    2024-07-21 19:48:01       22 阅读
  3. 记一次通过udev自动加在i2c接口触摸驱动过程

    2024-07-21 19:48:01       20 阅读
  4. 优选算法之滑动窗口(下)

    2024-07-21 19:48:01       23 阅读
  5. Linux常用命令(备忘自查)

    2024-07-21 19:48:01       21 阅读
  6. 计算机视觉发展历程

    2024-07-21 19:48:01       26 阅读