class companies(object):

    def __init__(self, text_name):
        text_file = open(text_name, 'r')
companies = {}
all_text = text_file.read()
line = all_text.split('\n')
for element in line:
    name, year, number = element.split(',')
companies[name] = [year, number]
self.companies = companies

def get_information(self, index):
    print(self.companies[index])
my_company = companies('company.txt')
my_company.get_information('Gardener')
using a class instead of a list python