Skip to content

Instantly share code, notes, and snippets.

@ilivessevili
Created January 26, 2016 05:14
Show Gist options
  • Save ilivessevili/8338697d75a26240b20e to your computer and use it in GitHub Desktop.
Save ilivessevili/8338697d75a26240b20e to your computer and use it in GitHub Desktop.
import os
1GB = 1024*1024*1024 # 1GB
with open('large_file', 'wb') as fout:
fout.write(os.urandom(1GB))
@ginward
Copy link

ginward commented Dec 14, 2018

I think python doesn't allow variable name like 1GB? better to use GB1.

@hakkikonu
Copy link

wrong variable name: Python variables can not start with numbers.

@jjbalcarcel
Copy link

As was mentioned before, python doesn't accept that var begin with numbers, but thank you for the main idea.

@Bittuw
Copy link

Bittuw commented Oct 7, 2020

This is not work for Windows if size is over than size_t value in C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment