lundi 13 août 2018

Python If Statement stop code execution

I'm new at Python & i don't understand why my if statement is not woking as expected.

My for loop uses a function to list filenames and content types

def listContentType(files):

   contentType = "text/xml"

   for filename in files:

       if '.html' in filename :
            contentType = 'text/html"

       #do something
       print(contentType)

But, when if Statement returns true, print never prints 'text/html'.

Do you know why?

Thanks!

Aucun commentaire:

Enregistrer un commentaire