[Tutor] Variables in workspace

bob gailer bgailer at alum.rpi.edu
Sat Oct 13 17:35:55 CEST 2007


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.




More information about the Tutor mailing list