Essentially, I wan this function to take a file name, read the contents of that file into the profile_list. I want the list of profile objects to be returned when the function is called, but I can't seem to get this to work. Any help would be greatly appreciated
def read_file(filename, profile_list):
infile = open(filename, "r")
profile_list = infile.readlines()
for i in range(len(profile_list)):
profile_list[i] = profile_list[i].rstrip('\n')
infile.close()
return profile_list
profile_list = []
read_file("profiles.txt", profiles_list)
I am a beginner, and I do know I'm making a mistake somewhere, I just don't know where. The problem is that it's just not reading anything when called.