import os outfh=open("disk1.flp","wb") for ind in range(80): cfn="program"+str(ind)+".bin" if os.path.exists(cfn): print ind hf=open(cfn,"rb") data=hf.read() hf.close() else: data="" if (len(data)<(36*0x200)): cmpdata=((36*0x200)-len(data))*"\x00" outfh.write(data) outfh.write(cmpdata) outfh.close()