Skip to content

Instantly share code, notes, and snippets.

@andreinechaev
Created August 21, 2018 20:34
Show Gist options
  • Save andreinechaev/f773aed0f3866a6c42526fc840e71747 to your computer and use it in GitHub Desktop.
Save andreinechaev/f773aed0f3866a6c42526fc840e71747 to your computer and use it in GitHub Desktop.
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