python的if声明中的默认比较是什么?

时间:2020-05-10 21:42:17

标签: python

在Python中创建'if'语句时,我们可以选择使用if boolean:,而无需进行显式比较(这不是强制性的)

问题是:在这种情况下,默认的比较是什么? if x:等于if x == Trueif x is True吗?

1 个答案:

答案 0 :(得分:-2)

不确定我是否理解您的问题,但是您可以使用:

while True:
    #do whatever here and it will loop infinitely

将一次返回“ hi”

如果您想进行无限循环,请尝试以下操作:

Data.findOneAndUpdate({ userID: user.id },
  { $set: { language: args[2], email: args[1] } },
  { new: true }).exec((err, data) => {
     //further response with updated data
});
相关问题