G
Gilles Ganault
Hello
I use regexes to extract information from a text file. Some of the
records don't have e-mails or www addresses, so those must match Null
in SQL, but None doesn't work as expected:
=======
if itemmatch:
web = itemmatch.group(1).strip()
else:
web = None
sql = 'INSERT INTO mytable (name,address,web,mail) VALUES
("%s","%s","%s","%s","%s")' % (name,address,web,mail)
=======
Is there a better way in Python to have a variable match NULL than
building the SQL query step by step?
Thank you.
I use regexes to extract information from a text file. Some of the
records don't have e-mails or www addresses, so those must match Null
in SQL, but None doesn't work as expected:
=======
if itemmatch:
web = itemmatch.group(1).strip()
else:
web = None
sql = 'INSERT INTO mytable (name,address,web,mail) VALUES
("%s","%s","%s","%s","%s")' % (name,address,web,mail)
=======
Is there a better way in Python to have a variable match NULL than
building the SQL query step by step?
Thank you.