Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- def find_holes(file):
- with open(file, "rb") as fd:
- fileno = fd.fileno()
- size = os.stat(fileno).st_size
- pos = 0
- holes = []
- while True:
- hole_start = os.lseek(fileno, pos, os.SEEK_HOLE)
- data_start = os.lseek(fileno, pos, os.SEEK_DATA)
- if hole_start == size:
- break
- holes.append((hole_start, data_start))
- if pos == data_start:
- break
- pos = data_start
- return holes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement