I have an input csv file with data:
a 15 b 14 c 20 d 45
I want to generate a different csv file which will contain complete data rows from input file but rows should be shuffled.
like output file may contain values-
b 14 a 15 c 20 d 45
I have tried this code:
import random
import sys
op=open('random.csv','w+')
ip=open(sys.argv[1],'r')
data=ip.read()
data1=str(random.choices(data))
op.write(data1)
op.close()
Aucun commentaire:
Enregistrer un commentaire