I want to create a file of particular size (say, 1GiB). The content is not important since I will fill stuff into it.
What I am doing is:
f = open("E:\\sample", "wb")
size = 1073741824 # bytes in 1 GiB
f.write("\0" * size)
But this takes too long to finish. It spends me roughly 1 minute. What can be done to improve this?