def openFood():
with open("FoodList.txt") as f:
lines = f.readlines()
for line in lines:
if 'Food' in line:
print(f.next())
openFood()
I want it where when it sees a certain header like 'Food' It will print the line below it. I cant seem to make it work. The text file will be like
Food
Apple
Cal 120
Protein 12
Fat 13
Carb 23