講解對(duì)象:python邏輯運(yùn)算符 作者:融水公子 rsgz 關(guān)鍵字: 與 and 或 or 非 not 注意: 1 and 和 or 也稱(chēng)作短路運(yùn)算符 2 and 和 or的參數(shù)從左向右解析 3 邏輯運(yùn)算符的優(yōu)先級(jí)又低于關(guān)系運(yùn)算符 4 not 具有最高的優(yōu)先級(jí),or 優(yōu)先級(jí)最低 實(shí)例: 1 進(jìn)入python3交互 2 執(zhí)行命令:5 and 4 3 執(zhí)行命令:0 and 4 4 執(zhí)行命令:False or 3 or 0 5 執(zhí)行命令:2 > 1 and not 3 > 5 or 4
|