我想知道是否可以使用“海象运算符”根据某些条件以及现有条件来分配值。例如,post_url如果该字符串包含某些子字符串,则将字符串分配给:
if post_url := data.get("Post url") and ("youtube" in data.get("Post url")):
# Do something with post_url
else:
# Do something else
但是,这只是post_url由于对and操作的评估而将布尔值分配给。