title = article.title
title = re.sub(r' - Wikipedia, the free encyclopedia','',title)
title_lower = title.lower()
title_lower = title_lower.replace(' ','-')
print title
print title_lower
title_query = ("INSERT INTO myguests "
"(firstname) "
"VALUES (%s)")
cursor.execute("SELECT id FROM myguests "
"WHERE firstname='"+title+"'")
row = cursor.fetchall()
if row !=[]:
print "List is not empty"
if not row:
print "List is empty"
title_query = title
print title
For some reason in my if statement my title variable keeps coming back empty when it is called if not row:
I am trying to insert variable if the variable dose not exist in column.
Aucun commentaire:
Enregistrer un commentaire