[Tutor] Sum files' size

Steven D'Aprano steve at pearwood.info
Thu Jul 28 21:43:57 CEST 2011


Susana Iraiis Delgado Rodriguez wrote:
> I want to get the size of  3 files. I already completed this step. Then I
> need to sum the 3 results I got. In order to do it I have the next code:
[...]
> #Finally I want to sum the 3 terms:
> total = kb+kb2+kb3
> But the output I got is : 15.5KB108.0bytes169.0bytes
> 
> Does anyone have an idea how to fix it?


Sum the three terms while they are still numbers, before you convert 
them into strings with units.




-- 
Steven



More information about the Tutor mailing list