Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, shutil
- def flipchunk(iterable, inc):
- chunks = [iterable[x:x+inc] for x in range(0, len(iterable), inc)]
- c2 = [x[::-1] for x in chunks]
- return c2
- def swap2bik(infile):
- with open(infile, "rb") as inf:
- data = inf.read()
- flipped = flipchunk(data, 4)
- output = b"".join(flipped)
- fname = infile.replace("bikswap", "bik")
- with open(fname, "wb") as ouf:
- ouf.write(output)
- def main(infolder):
- os.chdir(infolder)
- bikswaps = [x for x in os.listdir(os.getcwd()) if x.endswith(".bikswap")]
- for bikswap in bikswaps:
- swap2bik(bikswap)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement