Question: ```
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

```

Answer: 
Just use the index.

```
def openFood():
    with open("FoodList.txt")  as f:
        lines = f.readlines()
        for i in range(len(lines)-1):
            if 'Food' in lines[i]:
                print(lines[i+1])
openFood()

```
Since `readlines()` returns a list of the lines in the file that you can iterate over, you can simply access the subsequent line via its index:

```
l = len(lines)-1
for i in range(l):
    if 'Food' in lines[i]:
        print(lines[i+1])

```