Thank you to all of you!
After I read your mails I started to modify my code, I applied Ramit
suggestion and got the result I wanted:
mport os
file_list = []
folders = None
for root, folders, files in os.walk('C:\\'):
file_list.extend(os.path.join(
root,fi) for fi in files if (fi.ends
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.0b
>kb = sizeof_fmt(s)
>shx1 = os.path.getsize(shx)
>kb2 = sizeof_fmt(shx1)
> total = kb+kb2+kb3
Instead only retrieve the formatted output at the end. That way you will not
have to worry about converting back from strings, nor have to worry about
adding number with different units (e.g. 10KB + 10M
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:
import os
file_list = []
folders = None
for root, folders, files in os.walk('C:\\'):
file_list.ext
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:
import os
file_list = []
folders = None
for root, folders, files in os.walk('C:\\'):
file_list.extend(os.path.join(root,fi) for fi in files