I have a CSV file and I am running a script against it to insert into a database.
If the value is blank then I don’t want to insert it. Here is what I have
if attrs[attr] != '' and attrs[attr] != None:
log.info('Attriute ID: %s' % attr)
log.info('Attriute Value: %s' % attrs[attr])
sql = insert_attr_query(attrs[attr], object_id, attr)
cursor.execute(sql)
It’s blank and it doesn’t = ” or None, then wth does it =?
It’s probably whitespace i.e. a tab or string with spaces try:-