Escaping chars in Python and sqlite

前端 未结 4 2042
温柔的废话
温柔的废话 2020-12-05 06:21

I have a python script that reads raw movie text files into an sqlite database.

I use re.escape(title) to add escape chars into the strings to make them db safe befo

4条回答
  •  -上瘾入骨i
    2020-12-05 06:57

    I use re.escape(title) to add escape chars into the strings to make them db safe

    Note that re.escape makes a string re-safe -- nothing to do with making it db safe. Rather, as @Donal says, what you need is the parameter substitution concept of the Python DB API -- that makes things "db safe" as you need.

提交回复
热议问题