vendredi 23 octobre 2015

How do I create a csv file with 100,000 random pairs in python?

I need to create a csv file with 100,000 random pairs.

So far I have:

import random

randfile = open("Random.csv", "w" )
pairs = []
for i in range(100000):
    line1 = str(random.randint(1, 100))
    line2 = str(random.randint(1, 100))
    pair = line1, line2
    pairs.append(pair)

randfile.close()




Aucun commentaire:

Enregistrer un commentaire