当前位置:主页 > 软件编程 > Python代码 >

python 多个参数不为空校验方法

时间:2021-07-07 08:51:45 | 栏目:Python代码 | 点击:

在实际开发中经常需要对前端传递的多个参数进行不为空校验,可以使用python提供的all()函数

if not all([arg1, arg2, arg3]): # 当 arg1, arg2, arg3都不为空时all函数返回true
    return jsonify(errno=RET.PARAMERR, errmsg=u"参数不完整!")

您可能感兴趣的文章:

相关文章