-2
我很难理解python中的一些代码,并会真正感谢它的任何帮助。python中的这个意思是什么?
condition = "{field}::{cast} {operator} {value}".format(**{
'field': field_exp(field),
'cast': cast,
'value': json.dumps(parameter).replace('"', "'"),
'operator': operator})
我无法理解本声明中真正发生了什么。 “双冒号”是做什么的?又是什么格式(** ...意味着
代码另外,也有另一行:?
condition = "jsonb_typeof({field}::jsonb) is {not} null".format(**{
'field': field_exp(field),
'not': 'not' if parameter else ''})
此再次声明如下类似的模式,我会很感激,如果有人能解释这是怎么回事。在这里。
谢谢 体位
您是否尝试过运行它? – msw
双冒号没有做任何特别的事情。它只是意味着结果字符串中会有两个冒号,就像第二个字符串的“jsonb_typeof”和“is”和“null”一样。 – Kevin