我有一个元组:
details = ({}, [])
Run Code Online (Sandbox Code Playgroud)
由于以下元组中没有数据,我想返回null响应.为此我写信:
if not details:
return Response({})
else:
print "Not null"
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用,因为它始终在else部件中打印并且打印不为空.我是python的新手.任何帮助表示赞赏.