Nov-20-2018, 11:30 PM
Hello,
Is there a way to reliably split a string containing multiple sqlite statements?
Is there a way to reliably split a string containing multiple sqlite statements?
str.split(sep=None, maxsplit=-1)
does not always work -Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information. >>> sql = "select 'abc'; select 'def'; select 'annoying semicolon ;'" >>> sql.split(';') ["select 'abc'", " select 'def'", " select 'annoying semicolon ", "'"] >>>I was hoping to have something like -
["select 'abc'", " select 'def'", " select 'annoying semicolon ;'"]