csv - Python Csvwriter Randomize Rows -


is possible make randomizer randomizes entire rows using csvwriter? code have similar this:

 in range(45):     count=count+1     writer.writerow((count,pattern)) 

where pattern number corresponds count. example: when count=1 pattern=1; count=2 pattern=9; count=3 pattern=17, , on... want way randomize rows correct count corresponds correct pattern still. appreciated!

load 2 dimensional array storing count in a[i][0] , pattern in a[i][1] shuffle write them csv file.

import random  count = 0 = [] in range(45):     count = count + 1     a.append([count,pattern])  random.shuffle(a) in range(len(a)):     writer.writerow(a[i][0], a[i][1]) #a[i][0] = count, a[i][1] = pattern 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -