Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61771
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Subject | Re: Code suggestion - List comprehension |
| Date | 2013-12-13 09:35 +1100 |
| References | <CALVX-oZZoLzxF5F5-pWwCnGxv1pnHWqxf7-3AP2mE9OEdAcXKQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4038.1386887765.18130.python-list@python.org> (permalink) |
Shyam Parimal Katti <spk265@nyu.edu> writes: > A semi-colon in the string value indicates the termination of a sql query. > So the expected out come is a conversion to a list of valid sql queries: > ['drop table sample_table;', 'create table sample_test (col1 int);', > 'select col1 from sample_test;'] I presume these strings are split from lines of input. If so, you would be better advised to use an SQL parsing library in the first place <URL:https://pypi.python.org/pypi/sqlparse/>, to get distinct SQL statements from a text stream. -- \ “We must find our way to a time when faith, without evidence, | `\ disgraces anyone who would claim it.” —Sam Harris, _The End of | _o__) Faith_, 2004 | Ben Finney
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Code suggestion - List comprehension Ben Finney <ben+python@benfinney.id.au> - 2013-12-13 09:35 +1100
csiph-web