
任务: https://github.com/InternLM/Tutorial/blob/camp3/docs/L0/Python/task.md
完成:
任务1:Python实现wordcount
import re
from collections import defaultdict
def wordcount(text):
    # 转换为小写并使用正则表达式分割单词
    words = re.findall(r'\b\w+\b', text.lower())
    
    # 使用 defaultdict 来自动处理字典中不存在的键
    word_counts = defaultdict(int)
    
    # 统计每个单词出现的次数
    for word in words:
        word_counts[word] += 1
    
    return dict(word_counts)
if __name__ == "__main__":
    # 示例
    text = "One, world! one dream."
    result = wordcount(text)
    print(result)任务2:Vscode连接InternStudio debug笔记

 
 



















