Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save s3rgeym/690fc6c5abd997078160c3643f82511e to your computer and use it in GitHub Desktop.
Save s3rgeym/690fc6c5abd997078160c3643f82511e to your computer and use it in GitHub Desktop.
In [10]: f = open('/dev/nvme2n1p2', 'rb')

In [11]: data = f.read()

In [12]: len(data)
Out[12]: 16777216

In [13]: data[0]
Out[13]: 0

In [14]: data[1]
Out[14]: 0

...

In [17]: data[:100]
Out[17]: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

In [18]: type(data)
Out[18]: bytes

In [19]: all(c == 0 for c in f.read())
Out[19]: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment