gpt4 book ai didi

python - 为什么我不能在 Django 模板 View 中使用连字符?

转载 作者:太空狗 更新时间:2023-10-30 02:06:38 25 4
gpt4 key购买 nike

{{profile.first-name.value}}

我的变量只是炒作...我希望我可以做 first_name,但是很多变量都是连字符。但是,由于这个问题,我无法在模板中显示我的变量。为什么?

最佳答案

连字符是 Python 中的运算符。如果将所有连字符换成下划线,效果会更好。

关于python - 为什么我不能在 Django 模板 View 中使用连字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2213308/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com