Skip to content

Instantly share code, notes, and snippets.

@s3rgeym
Last active February 27, 2026 12:49
Show Gist options
  • Select an option

  • Save s3rgeym/370114bb57dd02169ac4f441a77f506d to your computer and use it in GitHub Desktop.

Select an option

Save s3rgeym/370114bb57dd02169ac4f441a77f506d to your computer and use it in GitHub Desktop.
def parse_size(size):
num, unit = size.split()
exp = ['B', 'kB', 'MB', 'GB'].index(unit)
return float(num) * 1024**exp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment