import os import sys start_idx = sys.argv[1] end_idx = sys.argv[2] with open("batch_submit.sh", "w") as f: for i, idx in enumerate(range(int(start_idx), int(end_idx), 48)): f.write(f"sbatch -J label{i} submit_labeling.sh {idx} {idx+48}\n") f.write("sleep 30\n")