python NameError: name 'false' is not defined

执行这行代码会报错,NameError: name 'false' is not defined

 response_content =  {"result":false,"returnCode":"500","message":"失败"}

你可以使用下面这两行代码来解决:

 false = False
 response_content =  {"result":false,"returnCode":"500","message":"失败"}

参考:https://www.e-learn.cn/content/wangluowenzhang/666425
https://stackoverflow.com/questions/28843876/nulls-instead-of-nones-in-json-data-with-python/28843950#28843950

猜你喜欢

转载自www.cnblogs.com/wanthune/p/11752762.html