Jul-13-2019, 12:18 PM
(This post was last modified: Jul-13-2019, 12:29 PM by ichabod801.)
import sys import os import random exam = sys.argv[1] folder = sys.argv[2] questions = [] for bank, number in zip(sys.argv[3::2], map(int, sys.argv[4::2])): qfiles = [ os.path.join(dirpath, fname) for dirpath, dirnames, filenames in os.walk(os.path.join(folder, bank)) for fname in filenames if os.path.splitext(fname)[-1].lower() == '.tex' ] for qfile in random.sample(qfiles, number): with open(qfile, 'r') as qfh: questions.append(qfh.read()) with open(exam, 'w') as efh: for question in questions: print(question, file=efh)Reference: https://tex.stackexchange.com/questions/...710#499710
everytime I try to run it, it tells me index error or population size too large/negative.
Any advice or guidance will be greatly appreciated :)