Created the following program in Python:
import csv
import os
from random import randint
with open('number.csv',"w") as f_out:
f_write = csv.writer(f_out,delimiter=',')
statinfo = os.stat('number.csv')
file_size = statinfo.st_size
x=[randint(0,99) for p in range(0,99)]
for i in x:
f_write.writerow(x)
The above program is not giving desired results; it writes the same line over and over and I don't know how to reach 1GB with this.
- Repetition of numbers is allowed.
- The file has to stop generating once the file size reaches 1 GB.
- So I want random numbers (0,99), comma separated with series of lines with same number of columns in each line until the file size reaches 1 GB.
Aucun commentaire:
Enregistrer un commentaire