I have a txt file with multiple strings on each line as below:
Hamburger: Ground Beef, Onion, Tomato, Bread, Ketchup
Pesto_Chicken: Chicken, Peppers, Pasta, Pesto
Surf_and_Turf: Steak, Fish
I'd like to read it into my program and create a list for each line. Ideally using the first word of each line (ie Hamburger, etc.) as the list name, but that's not critical. I just need to get each line into its own list. So far I can read it in and print to the console, but not sure how to store as a list??
filepath = 'recipes.txt'
with open(filepath) as fp:
line = fp.readline()
cnt = 1
while line:
print("Line {}: {}".format(cnt, line.strip()))
line = fp.readline()
cnt += 1