跳到主要内容
CodeWiki
练习
学习路径
学习方向
速查表
试验场
术语表
AI 时代
搜索
⌘K
中文
英语
中文
练习
学习路径
学习方向
速查表
试验场
术语表
AI 时代
中文
英语
中文
练习
/
测验
/
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),哪项分类正确?
测验
下一道练习
这段程序会输出什么?
预测输出
有新版本可用
重新加载