Created
March 22, 2021 12:28
-
-
Save shanehh/1dc5f0575439248aa7cb55f9f9e27701 to your computer and use it in GitHub Desktop.
Sometimes you need to create a file of a specified size...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_any_MB_file(filepath, n): | |
with open(filepath, 'wb+') as f: | |
for _ in range(2**20 * n): | |
f.write(bytes(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment