[Tutor] referencing vars()

Michael Langford mlangford.cs03 at gtalumni.org
Sat Sep 15 21:54:40 CEST 2007


Please show us the function vars(). I don't think we have enough info to
help without it.

On 9/15/07, John <washakie at gmail.com> 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, "wb"))
>                         writer.writerows(var)
>
> 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??
>
> Suggestions?
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.TierOneDesign.com/
Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070915/14561627/attachment.htm 


More information about the Tutor mailing list