入门岛
第一关 Linux基础知识
任务1:完成SSH连接与端口映射并运行hello_world.py
①服务器添加公钥:
②vscode建立连接:
③服务器下载依赖:
pip install gradio==4.29.0
④本地power shell建立端口映射:
ssh -p 38312 root@ssh.intern-ai.org.cn -CNg -L 7860:127.0.0.1:7860 -o StrictHostKeyChecking=no
⑤效果展示:
第二关 Python基础知识
任务一:Python实现wordcount
①创建test.py
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):
text_dict = dict()
# 变成一行
text = text.replace('\n', ' ')
# 按空格划分单个字符
text_list = text.split(' ')
# 删除标点符号
text_list = [t.split(',')[0].split('.')[0] for t in text_list]
# 转成小写
text_list = [t.lower() for t in text_list]
# 去除无效字符
text_list = [t for t in text_list if t != '']
for t in text_list:
if t not in list(text_dict.keys()): text_dict[t] = 1
else: text_dict[t] += 1
for k, v in text_dict.items():
print(f'{k}: {v}')
if __name__ == "__main__":
wordcount(text)
②运行代码:
python test.py
③结果展示:
任务二:Vscode连接InternStudio debug笔记
①启动debug
②debug过程