文档里字符串的比较与计数,该怎么解决

文档里字符串的比较与计数
如何计算一个文档里的一列有多少不同的字符串
比如有一a.txt
111;abcdefg;17
132;efdghjra;18
113;e70a23e;16
134;e70a23e;18
115;abcdefg;19
要问第2列'abcdefg'这列,有多少个不一样的字符串。谢谢各位老师帮忙

------解决方案--------------------
Python code
aDict = {};
fd = open('test.txt')
for line in fd:
    x, y, z = line.split(';')
    aDict[y] = 1
fd.close()
print aDict

------解决方案--------------------
用正则加set

Python code
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import re
>>> s = '''111;abcdefg;17
132;efdghjra;18
113;e70a23e;16
134;e70a23e;18
115;abcdefg;19'''
>>> res = r';(.*?);'
>>> m = re.findall(res,s)
>>> set(m)
set(['e70a23e', 'efdghjra', 'abcdefg'])
>>> print len(set(m))
3
>>>

------解决方案--------------------
Python code

print len(set(l.split(';')[1] for l in open('a.txt')))