Python Program Read a File Line by Line Into a List
with open("data_file.txt") as f:
content_list = f.readlines()
# print the list
print(content_list)
# remove new line characters
content_list = [x.strip() for x in content_list]
print(content_list)
Output
['honda 1948\n', 'mercedes 1926\n', 'ford 1903'] ['honda 1948', 'mercedes 1926', 'ford 1903']
