如果语句简单

问题描述 投票:0回答:2

是否有一种方法可以使此ELIF语句更简单,使此代码不起作用。更改的变量为APPOINTMENT

elif (rut == '80010900-0' and agental_launch != "" and 'TAL'  in appointment) or
        (rut == '80010900-0' and agental_launch != "" and 'IQQ'  in appointment) or
        (rut == '80010900-0' and agental_launch != "" and 'ANF'  in appointment) or
        (rut == '80010900-0' and agental_launch != "" and 'MJS'  in appointment) or
        (rut == '80010900-0' and agental_launch != "" and 'QTV'  in appointment) or
        (rut == '80010900-0' and agental_launch != "" and 'SVE'  in appointment) or
        (rut == '80010900-0' and agental_launch != "" and 'PMC'  in appointment) or
        (rut == '80010900-0' and agental_launch != "" and 'CHB'  in appointment):
        df.at[idx,'REBATE'] = round(int(monto_neto)*0.35)
python if-statement variables var
2个回答
0
投票
elif rut == '80010900-0' and agental_launch != "" and any(elem in appointment for elem in ['TAL','IQQ','ANF','MJS','QTV','SVE','PMC','CHB']): df.at[idx,'REBATE'] = round(int(monto_neto)*0.35)
© www.soinside.com 2019 - 2024. All rights reserved.