Hello everybody,
I want to get the filesize of a folder and store it as a variable. So far I've manged to do so:
For example, instead of 1515124421 I want it to look like 1.515.124.421
How can I do so?
I want to get the filesize of a folder and store it as a variable. So far I've manged to do so:
import os
def get_size(start_path = '.'):
total_size = 0
for dirpath, dirnames, filenames in os.walk(start_path):
for f in filenames:
fp = os.path.join(dirpath, f)
if not os.path.islink(fp):
total_size += os.path.getsize(fp)
return total_size
line = get_size()
print(line)Now I want to expand on that so that, going from the end to beginning, after every 3 digits it adds a point. For example, instead of 1515124421 I want it to look like 1.515.124.421
How can I do so?
