#!/usr/bin/python # # # Extract user names from the .classlist file to load into MarkUs # with the Users->Students->Upload feature # # bwbecker 091215 # # Updated by yc2lee (Nick) on Dec 20 to auto-detect course name import re,os,pwd course = pwd.getpwuid(os.getuid())[0] if __name__ == "__main__": regex = re.compile('^[0-9]{8}:([a-z0-9]+):([^:]*):.*') for line in open('/u/%s/.classlist' % course, 'r'): match = regex.match(line) if match != None: userid = match.group(1) name = match.group(2) userid = userid[0:8] print "%s,%s" % (userid, name)