查找 ExecutionResult 的返回值 - python-graphene



我是python的新手(javascript开发人员(

我正在遵循一个教程(不太擅长解释为什么(使用Python和Graphene。

我的问题是当我打印result收到时

<graphql.execution.base.ExecutionResult object at 0x1071ad410>

在 JavaScript 中,当您控制台日志时,您可以看到结果变量中包含的内容,

但不确定为什么我不能在 Python 中做同样的事情,除非我做错了?

从谷歌搜索来看,它看起来像返回数据,但实际记录并在终端中查看它会很有用,

import graphene
import json
class Query(graphene.ObjectType):
hello = graphene.String()
is_admin = graphene.Boolean()
def resolve_hello(self, info):
return "world"
def resolve_is_admin(self, info):
return True

schema = graphene.Schema(query=Query)
result = schema.execute(
'''
{
isAdmin
}
'''
)
print(type(result))
print(result)

i would expect to see the what is the result of the variable `result`

执行以下操作以在控制台中查看数据:

print(result.data)

最新更新