python need some help
Posted
by maxt0r
on Stack Overflow
See other posts from Stack Overflow
or by maxt0r
Published on 2010-05-31T12:08:24Z
Indexed on
2010/05/31
12:13 UTC
Read the original article
Hit count: 223
python
hi i have my codes i have to do a module def subjects but i cant figure out how can u help me thanks.
class Enrol:
def init(self, dir):
def readFiles(, dir, files):
for file in files:
if file == "classes.txt":
class_list = readtable(dir+"/"+file)
for item in class_list:
Enrol.class_info_dict[item[0]] = item[1:]
if item[1] in Enrol.classes_dict:
Enrol.classes_dict[item[1]].append(item[0])
else:
Enrol.classes_dict[item[1]] = [item[0]]
elif file == "subjects.txt":
subject_list = readtable(dir+"/"+file)
for item in subject_list:
Enrol.subjects_dict[item[0]] = item[1]
elif file == "venues.txt":
venue_list = readtable(dir+"/"+file)
for item in venue_list:
Enrol.venues_dict[item[0]] = item[1:]
elif file.endswith('.roll'):
roll_list = readlines(dir+"/"+file)
file = os.path.splitext(file)[0]
Enrol.class_roll_dict[file] = roll_list
for item in roll_list:
if item in Enrol.enrolled_dict:
Enrol.enrolled_dict[item].append(file)
else:
Enrol.enrolled_dict[item] = [file]
try: os.walk(dir, _readFiles, None)
except: print "directory not properly been recognise error"
def subjects(what should i write here??): for name in suject_list: print name,
out put should look like
import enrol
e = enrol.Enrol("/path/to/data")
e.subjects()
['bw101', 'bw110', 'bw232', 'bw290', 'bw660']
© Stack Overflow or respective owner