跳到主要内容
CodeWiki
练习
学习路径
学习方向
速查表
试验场
术语表
AI时代
搜索
⌘K
English
中文
练习
学习路径
学习方向
速查表
试验场
术语表
AI时代
English
中文
练习
/
测验
/
Python
/
*args与**kwargs
capture定义为def capture(**metadata),再调用capture(**{"content-type": "json"}) 时会发生什么?
来自*args与**kwargs
Python 3.14
高级
3分钟
capture定义为def capture(**metadata),再调用capture(**{"content-type": "json"}) 时会发生什么?
metadata变为 {'content-type': 'json'},因为映射键是字符串。
程序抛出SyntaxError,因为键中含有连字符。
程序抛出TypeError,因为每个关键字键都必须是有效标识符。
键会被规范化,因此metadata变为 {'content': 'json'}。
检查
向AI询问这道练习
报告错误
上一道练习
对于def route(path, /, version, *parts, strict=True, **metadata),哪项分类正确?
测验
下一道练习
这段程序会输出什么?
预测输出
有新版本可用
重新加载