Look at the
split section That might help you a bit.
Here is a fast inplementation of it, it's not ideal, but it will give you a hint..
Code:
#!/usr/bin/python
import re # make regular expression available
list = []
f = open("Studentlist.txt", "r") # open file
lines = f.readlines() # make every line available
for line in lines: # loop through lines
if not re.match("^-", line): # if line dosn't start with '-'
list.append(re.split('[\W]+', line[0:-1]))# add splitted line
del list[0] # remove the first line "ID | etc "
for item in list:
if len(item):
print "--------------------------------"
print "Student ID:\t", item[0]
print "Student Name:\t", item[1], item[2]
print "Student Class:\t", item[-1]