Re: [Tutor] referencing vars()

2007-09-17 Thread John
Kent, Thanks this is exactly the solution I am looking for... so simple. On 9/15/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > John wrote: > > #Set up writer > > import csv > > vardict=vars() > > for var in vardict: > > if var=='allcum' or var==

Re: [Tutor] referencing vars()

2007-09-16 Thread Terry Carroll
On Sat, 15 Sep 2007, John wrote: > I'm trying to do the above, but of course get an error because vardict is > only referencing vars(), thus changes size... also, I tried > vardict=[vars()], but this fails as well?? How about import copy vardict=copy.copy(vars()) That way, you've made a copy

Re: [Tutor] referencing vars()

2007-09-15 Thread Alan Gauld
"Michael Langford" <[EMAIL PROTECTED]> wrote > Please show us the function vars(). I don't think we have enough > info to > help without it. Its a builtin, it basically is similar to locals() as used here. Try help(vars) Alan G. ___ Tutor maillis

Re: [Tutor] referencing vars()

2007-09-15 Thread Kent Johnson
John wrote: > #Set up writer > import csv > vardict=vars() > for var in vardict: > if var=='allcum' or var=='alldhdt': > outfile=in_path+'/'+dataset+'_'+str(var)+'.csv' > writer = csv.writer(open(outfile

Re: [Tutor] referencing vars()

2007-09-15 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote >import csv >vardict=vars() >for var in vardict: >if var=='allcum' or var=='alldhdt': > > outfile=in_path+'/'+dataset+'_'+str(var)+'.csv' >writer = csv.writer(open(outfile, "wb")) >

Re: [Tutor] referencing vars()

2007-09-15 Thread Michael Langford
Please show us the function vars(). I don't think we have enough info to help without it. On 9/15/07, John <[EMAIL PROTECTED]> wrote: > > #Set up writer > import csv > vardict=vars() > for var in vardict: > if var=='allcum' or var=='alldhdt': >

[Tutor] referencing vars()

2007-09-15 Thread John
#Set up writer import csv vardict=vars() for var in vardict: if var=='allcum' or var=='alldhdt': outfile=in_path+'/'+dataset+'_'+str(var)+'.csv' writer = csv.writer(open(outfile, "wb"))