| midrange.com code scratchpad | 
				
					| 
							
								| Name:categories.py | Scriptlanguage:Python | Tabwidth:4 | Date:06/16/2011 10:05:39 pm | IP:Logged |  | 
				
					| Description:Python program for Dennis's task (Subject: Identifying unique sets of combinations [posted Fri, 03 Jun 2011 12:40:12 -0400]) | 
				
					| Code: 
							
								
								
								| 
    tapctgr = File400('TAPCTGR', 'r')
 categories = {}
tapctgr.posf()
while not tapctgr.readn():
    category = tapctgr['GRCTG']
    absence_code = tabctgr['GRATCD']
    if category in categories:
        categories[category].append(absence_code)
    else:
        categories[category] = [absence_code]
tapctgr.close()
 content_table = {}
for category in categories:
    categories[category].sort()
    contents = categories[category]
    if contents in content_table:
        content_table[contents].append(category)
    else:
        content_table[contents] = [category]
 for contents in content_table:
    if len(content_table[contents]) > 1:
        print contents, 'are in', content_table[contents]
  |  | 
				
					|  |