Hi Rick, Nice little script indeed !
You probably mean > trans = xlat.get(f,None) instead of > trans = xlat.get(f,'None') in the case where an invalid format character is supplied. The string 'None' evaluates to True, so that trans(words[i]) raises an exception A variant, with a list comprehension instead of the for loop : def parseline(line,format): xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} result = [] words = line.split() result = [ xlat[f](w) for f,w in zip(format,words) if xlat.get(f,None) ] if not result: return None if len(result) == 1: return result[0] return result Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list