jeudi 26 décembre 2019

In if statement I am getting all files instead of the files that the condition I gave for [duplicate]

This question already has an answer here:

so in the below code I am not getting the required files instead I am getting all the files. I couldn't understand the problem.

for i in range(len(files)):
    filename,exten=os.path.splitext(files[i])
    #print(exten)
    if exten == '.jpg' or '.txt':
        print(files[i])

Aucun commentaire:

Enregistrer un commentaire