Created
August 2, 2017 07:49
-
-
Save hig3/1c9f55dafc7c00a30fdc7830179606b6 to your computer and use it in GitHub Desktop.
Python script to make directory structure of feedback files from the offline grading worksheet in Moodle Assignments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/local/bin/python | |
# mkdirfb.py | |
# make directories to be zipped for feedback files | |
# from offline grading worksheet | |
# of Assignment activity in Moodle | |
# Usage: cat offlinegradingworksheet.csv | python mkdirfb.py | |
# Saburo Higuchi | |
# Time-stamp "2017-08-02 Wed 16:47 JST hig" | |
import csv | |
import sys | |
import re | |
import os | |
reader = csv.reader(sys.stdin, delimiter=',',quotechar='"') | |
header=next(reader) # skip the header | |
# Assume: | |
# row[0] internal participant ID | |
# row[1] Fullname | |
for row in reader: | |
partid=int(re.match(r'^[^\d]*(\d.*)$',row[0]).group(1)) | |
fullname=row[1] | |
dirname="%s_%s_assignsubmission_file_" % (fullname,partid) | |
print(dirname) | |
# note no error checking | |
os.mkdir(dirname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment