I am writing a program that relays the number of integers in every 10,000,000 integers. There are over 1 billion integers in the file. The output needs to go to a different file. Is there a function I can use that will loop through every 10,000,000 integers for me rather than typing count_numbers(0, 10000001) count_numbers(1000000, 20000001) etc. every time? I currently have the following code:
f = open("countoutput.txt", "w")
def count_numbers(x, y):
count = 0
for line in filename:
for number in line.split():
if int(number) > x and int(number) < y:
count += 1
f.write(str(count))