Skip to content

Instantly share code, notes, and snippets.

@thurask
Created June 3, 2019 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thurask/884a26f3d3db30b5944cccfd062afe34 to your computer and use it in GitHub Desktop.
Save thurask/884a26f3d3db30b5944cccfd062afe34 to your computer and use it in GitHub Desktop.
import collections
import os
def header_reader(infile):
with open(infile, "rb") as afile:
afile.seek(36)
bval = afile.read(1)
ival = int.from_bytes(bval, byteorder="big")
return ival
def dicter():
packs = [os.path.abspath(x) for x in os.listdir() if x.endswith(".package")]
dictx = {c.replace(os.getcwd(), ""): header_reader(c) for c in packs}
dictsort = collections.OrderedDict(sorted(dictx.items(), key=lambda x: x[1]))
for key, val in dictsort.items():
print("{}: {}".format(key, val))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment