Re: Code suggestion - List comprehension

2013-12-13 Thread Mark Lawrence
On 13/12/2013 09:43, Peter Otten wrote: Shyam Parimal Katti wrote: Hello, I have a list of sql queries, some which are split across multiple list elements e.x. ['drop table sample_table;', 'create table sample_test', '(col1 int);', 'select col1 from', ' sample_test;'] A semi-colon in the stri

Re: Code suggestion - List comprehension

2013-12-13 Thread Peter Otten
Shyam Parimal Katti wrote: > Hello, > > I have a list of sql queries, some which are split across multiple list > elements e.x. > ['drop table sample_table;', 'create table sample_test', '(col1 int);', > 'select col1 from', ' sample_test;'] > > A semi-colon in the string value indicates the ter

Re: Code suggestion - List comprehension

2013-12-12 Thread Ben Finney
Shyam Parimal Katti 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

Re: Code suggestion - List comprehension

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 7:40 AM, Shyam Parimal Katti wrote: > sample = ['drop table sample_table;', 'create table sample_test', '(col1 > int);', 'select col1 from', ' sample_test;'] > pure_sqls = [] > query_holder= '' > for each_line in sample: > query_holder += each_line > if query_holder

Re: Code suggestion - List comprehension

2013-12-12 Thread Mark Lawrence
On 12/12/2013 20:40, Shyam Parimal Katti wrote: Hello, I have a list of sql queries, some which are split across multiple list elements e.x. ['drop table sample_table;', 'create table sample_test', '(col1 int);', 'select col1 from', ' sample_test;'] A semi-colon in the string value indicates t

Re: Code suggestion - List comprehension

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 7:40 AM, Shyam Parimal Katti wrote: > 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

Code suggestion - List comprehension

2013-12-12 Thread Shyam Parimal Katti
Hello, I have a list of sql queries, some which are split across multiple list elements e.x. ['drop table sample_table;', 'create table sample_test', '(col1 int);', 'select col1 from', ' sample_test;'] A semi-colon in the string value indicates the termination of a sql query. So the expected out