0
for row in rowsList:
    if row['middle'] is None:
        row['middle'] == ""
    print("{} {} {}, born {}".format(row['first'], row['middle'], row['last'], row['birth']))

Where middle name in database is NULL I get None. When I have None I don't want to print it. I could use one print when is None and the other print when is not, but I am wondering why is row['middle'] == "" not updating that value although it enter the if clause?

enter image description here

1

Maybe a typo? == is not the set operator, it is the relational operator. This row['middle'] == "" evaluates to False; it does not change the value of row['middle'].

1
  • Yes indeed! It sould be row['middle'] = "". Thanks! – Hrvoje T Jul 31 '20 at 12:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .