f=open('candy.txt') lines=f.readlines() # readlines will give you a list of each line print(lines[3].rstrip('\n')) # this is the fourth line print(lines[6].rstrip('\n')) # this is the seventh line