I found this question on the internet,
Create a text file with name filename and about size bytes. The file should contain
an incrementing number on each line starting with 0. (ie) 0, 1, 2, 3, .... as many are required to make the file size
just >= size. Each line should end with windows newline ("\r\n").
I don't think i understand the question really well. I wrote a code but it doesn't generate the file as expected. Can anyone tell me what is to be done?? The assertion codes that are used to check my written code checks whether each line ends with "\r\n" and the use of "\r\n" must be just <= 1.. I don't understand how it can be achieved!
Here's my code!
def create_file_numbers(filename, size):
count = 0
f = open(filename,'wb')
while os.stat(filename).st_size < size:
f.write(str(count))
count += 1
f.write('\r\n')