For the following Python code:
fp = open(\'output.txt\', \'wb\') # Very big file, writes a lot of lines, n is a very large number for i in range(1, n): f
Building on ataylor's comment to the question:
You might want to nest your loop. Something like
for i in range(1,n): for each in range n: fp.write('something') fp.close()
That way, the only thing that gets put into memory is the string "something", not "something" * n.
"something"
"something" * n