mardi 21 septembre 2021

Create multiple files with same programm but different results

so Im having a problem with my code:

for i in range(10):
    a = ([random.randint(1, 1000) for j in range(10)])
    print(*a, sep = ".jpg, ", end = ".jpg, \n")
    f = open("test.cvs", "x")
    f.close()
        

my current output looks like this:

689.jpg, 715.jpg, 772.jpg, 639.jpg, 903.jpg, 264.jpg, 226.jpg, 629.jpg, 306.jpg, 
758.jpg, 
458.jpg, 355.jpg, 262.jpg, 889.jpg, 244.jpg, 849.jpg, 613.jpg, 439.jpg, 646.jpg, 
766.jpg, 
481.jpg, 954.jpg, 192.jpg, 742.jpg, 598.jpg, 373.jpg, 522.jpg, 685.jpg, 404.jpg, 
164.jpg, 
12.jpg, 202.jpg, 600.jpg, 365.jpg, 635.jpg, 938.jpg, 189.jpg, 492.jpg, 871.jpg, 
611.jpg, 
67.jpg, 256.jpg, 102.jpg, 587.jpg, 637.jpg, 759.jpg, 252.jpg, 175.jpg, 561.jpg, 
965.jpg, 
470.jpg, 744.jpg, 897.jpg, 367.jpg, 765.jpg, 455.jpg, 848.jpg, 258.jpg, 615.jpg, 
910.jpg, 
111.jpg, 344.jpg, 605.jpg, 292.jpg, 511.jpg, 548.jpg, 452.jpg, 836.jpg, 285.jpg, 
152.jpg, 
582.jpg, 716.jpg, 33.jpg, 387.jpg, 335.jpg, 855.jpg, 487.jpg, 57.jpg, 668.jpg, 
41.jpg, 
765.jpg, 424.jpg, 196.jpg, 124.jpg, 898.jpg, 549.jpg, 590.jpg, 42.jpg, 944.jpg, 
462.jpg, 
682.jpg, 728.jpg, 145.jpg, 206.jpg, 246.jpg, 734.jpg, 519.jpg, 618.jpg, 903.jpg, 
662.jpg

which is perfect, i want it exactly like that, but i want to create a file for every output. It cant be the same result in multiple files. Is it possible to let the numbers generate then put the output inside a file and then again let the numbers generate again and put it in a new file. The goal is to create .cvs files Thank you in advance.




Aucun commentaire:

Enregistrer un commentaire