dimanche 13 mai 2018

Questions about if and conditional statements

The data type of row [23] is nvarchar.

per1 = ".25"
per2 = ".75"
if row [23] == 'sale1' or row [23] == 'sale2':
     if row [27] .find (per1) == -1 and row [27] .find (per2) == -1:
         cursor.execute (sql)
else:
     cursor.execute (sql)

The result is not filtered at all. But if you try this

per1 = ".25"
per2 = ".75"
if row [23] == 'sale1' or row [23] == 'sale2':
   if row [27] .find (per1) == -1:
      cursor.execute (sql)
   else:
      cursor.execute (sql)

or

per1 = ".25"
per2 = ".75"
if row [23] == 'sale1' or row [23] == 'sale2':
   if row [27] .find (per1) == -1 and row [27] .find (per2) == -1:
      cursor.execute (sql)
   else:
      cursor.execute (sql)

Filtering is in progress. I tried several times in a few days, but I can not get the result I want.

Aucun commentaire:

Enregistrer un commentaire