[Tutor] Variables in workspace

Eli Brosh ebrosh at nana10.co.il
Sun Oct 14 18:05:07 CEST 2007


Many thanks to Bob and Kent and all the good people in the tutor forum.
The dir() and del work really well !
 
Eli

________________________________

מאת: bob gailer [mailto:bgailer at alum.rpi.edu]
נשלח: ש 10/13/2007 17:35
אל: Kent Johnson
עותק לידיעה: Eli Brosh; tutor at python.org
נושא: Re: [Tutor] Variables in workspace



Kent Johnson wrote:
> bob gailer wrote:
>> The del statement is the way to delete variables. Since dir() gives
>> you their names one needs use eval.
>>
>> for varName in dir():
>>     eval 'del ' + varName
>
> I think del globals()[varName] would work.
Yep. That was nagging a corner of my brain, but not surfacing.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071014/56946c68/attachment-0001.htm 


More information about the Tutor mailing list