Your post is confusing. Here is my advice: investigate the use of dictionaries. Dictionaries can allow you to define data in the form { key:data }, e.g. { area_code : area_data } { (area_code,school_code) : school_data } { (school_code,student_code) : student_data }