How can I insert NULL data into MySQL database with Python?

后端 未结 4 1750
北荒
北荒 2020-12-03 00:16

I\'m getting a weird error when inserting some data from a Python script to MySQL. It\'s basically related to a variable being blank that I am inserting. I take it that MyS

4条回答
  •  青春惊慌失措
    2020-12-03 01:11

    Why not set the variable equal to some string like 'no price' and then filter this out later when you want to do math on the numbers?

    filter(lambda x: x != 'no price',list_of_data_from_database)
    

提交回复
热议问题