mardi 15 mai 2018

2 conditions for if statement python 3 [duplicate]

This question already has an answer here:

so i have a list of items with some of the items being suffixed with '_instr' or '-Instr'

ive written an if statement to capture the items that dont have those tags:

spss_ntests=[]
#add to list columns without _Instr in them
for i in spss_columns:
    if ('_instr' or '-Instr') not in i:
        spss_ntests.append(i)

I've tried every iteration of putting the conditions in seperate brackets and toegther but it either captures nothign or just the '-instr' tags.

Any ideas?

Aucun commentaire:

Enregistrer un commentaire