When you have a file with a lot of lines of numbers. I want to know if instead of writing the formula to calculate the numbers for everyline of data. Is there a way to tell it to apply the formula I have made to every line until there are no lines left ,or do I have to re input the formula for everyline so it calculates eachline?

Your question is much too vague. You should describe the content of your file and the 'formula' that you want to apply. A general pattern to handle several lines of data is

def handle_line(line):
    pass # do whatever you want with a line here

for line in open("myfile.txt"):