Bring value from walk()

Andreas Cardeneo Andreas.Cardeneo at mach.uni-karlsruhe.de
Fri Feb 25 07:35:21 EST 2000


Milos Prudek schrieb:
> 
> Is there (an object oriented) way to bring Total from Estimatespace thru
> EstDirSpace right back into main program?
> 
> def Estimatespace(Fs, Dirn, Nams):
>     print Dirn
>     for X in Nams:
>         Fs=Fs+os.stat(Dirn+'/'+X)[stat.ST_SIZE]
>         print '-',X,Fs
>     # Total=Total+Fs
>     return

In Estimatespace you should initialize Total with zero,
so python knows the value the first time you add Fs to it.
And then return Total.


hth,

Andreas



More information about the Python-list mailing list