#!/usr/bin/env python3 import sys import csv import random random.seed(1234) vids = {} for line in csv.DictReader(open(sys.argv[1])): fn = line['wav_filename'].split('/')[-1] vid = "_".join(fn.split("_")[:-1]) if vid not in vids: vids[vid] = "v_" + fn keys = list(vids.keys()) size = len(keys) for i in range(3000): j = random.randint(0, size) k = random.randint(0, size) while k == j: k = random.randint(0, size) print (vids[keys[j]], vids[keys[k]])