Re: [Tutor] how-to generate specific lines of text from two python lists

2017-06-26 Thread Mats Wichmann
On 06/25/2017 12:44 PM, Tahir Hafiz wrote: > Thanks Alan and Peter, > > Alan you are right this could be solved via an SQL statement but I was > asked to finish the python script. > Anyways, this worked and helped to solve the problem in the end: > > # Create iterator object, dictionary which can

Re: [Tutor] how-to generate specific lines of text from two python lists

2017-06-25 Thread Danny Yoo
On Jun 25, 2017 12:05 PM, "Danny Yoo" wrote: As the other tutors have suggested, look into doing the SQL updates directly, rather than format strings of SQL commands. Ah, here's a good resource: http://bobby-tables.com Just to emphasize: the reason I'm pointing this out is to try to counterba

Re: [Tutor] how-to generate specific lines of text from two python lists

2017-06-25 Thread Danny Yoo
As the other tutors have suggested, look into doing the SQL updates directly, rather than format strings of SQL commands. A major reason is because strings do not natively support the representation of nested, grammatical things like sentences or SQL commands. It's really easy to write a string f

Re: [Tutor] how-to generate specific lines of text from two python lists

2017-06-25 Thread Tahir Hafiz
Thanks Alan and Peter, Alan you are right this could be solved via an SQL statement but I was asked to finish the python script. Anyways, this worked and helped to solve the problem in the end: # Create iterator object, dictionary which can be used to iterate against. b_iter = iter(new_emails)

Re: [Tutor] how-to generate specific lines of text from two python lists

2017-06-22 Thread Alan Gauld via Tutor
On 21/06/17 21:26, Tahir Hafiz wrote: > My python skills are limited but I have managed to generate a couple > of lists using python and the psycopg2 library by querying a postgress > table and it's columns. You say your python skills are limited but how about your SQL skills? The reason I ask is

Re: [Tutor] how-to generate specific lines of text from two python lists

2017-06-21 Thread Peter Otten
Tahir Hafiz wrote: > Hi All, > > My python skills are limited but I have managed to generate a couple > of lists using python and the psycopg2 library by querying a postgress > table and it's columns. > I would like to use the two generated lists from the python script to > create a file called u

[Tutor] how-to generate specific lines of text from two python lists

2017-06-21 Thread Tahir Hafiz
Hi All, My python skills are limited but I have managed to generate a couple of lists using python and the psycopg2 library by querying a postgress table and it's columns. I would like to use the two generated lists from the python script to create a file called upgrade_email_addresses.sql (and th