Created
August 21, 2018 20:34
-
-
Save andreinechaev/f773aed0f3866a6c42526fc840e71747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def get_meta(line): | |
splitted = line.split() | |
if len(splitted) <= 4: | |
return None, None, None | |
s = float(splitted[2]) | |
t = splitted[3] | |
name = splitted[4].strip() | |
return s, t, name | |
with open('fifthsun-dev.txt', 'r') as f: | |
lines = f.readlines() | |
large = [] | |
med = [] | |
small = [] | |
for l in lines: | |
if 'MiB' in l or 'GiB': | |
size, t, name = get_meta(l) | |
if size is None or t is None or name is None: | |
continue | |
if t == 'MiB': | |
if 10.0 < size < 500.0: | |
small.append(name) | |
elif 500.0 < size < 800.0: | |
med.append(name) | |
if size > 800.0 or t == 'GiB': | |
large.append(name) | |
print(f"Small = {len(small)}\nMedium = {len(med)}\nLarge = {len(large)}") | |
print(small[:20]) | |
print(med[:20]) | |
print(large[:20]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment