I tried two solutions from the list, they being:
all_values = [] with open('message.txt', newline='') as infile: for line in infile: all_values.extend(int(line.strip().split(',')))
my_file = open("message.txt", "r") # reading the file data = my_file.read() # replacing end of line('/n') with ' ' and # splitting the text it further when '.' is seen. data_into_list = int(data.replace('\n', ' ').split(".")) # printing the data print(data_into_list) my_file.close()Both of them prompt the error
Error:TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'