There are a few things to note first. That def loadFile() statement won't compile without a : colon at the end, and at least one true statement afterward. If you want to put in a "stub" for a function, that one statement can be a pass statement (does nothing--but "but on purposes"), with something like:
def loadFile(fname):
.... pass ###TODO: Finish this!
It's a common pattern to use "TODO" in a comment field for something that needs attention before the program is considered complete.
Also, you never closed that input file. Opened files require operating system resources, so you should close them as soon as you are done. It's a common thing to forget, and Python has a statement precisely to help you not forget. It's called the "with" statement and you'll see it below.
Notice I threw in an argument named "fname". I'd expect such a function to be able to load more than one file, so it's natural for the caller to say which file should be loaded. The function should take care of the rest. I assume that's reading a whole file into a list of strings, one for each line of the file, since that's what your loop does. So try this:
def readFile(fname):
.... result = []
.... with open(fname, 'r') as infile: # this is the with statement
.... .... for line in infile:
.... .... .... result.append(line)
.... return result
A with statement takes an object expression (usually an open() call to create a file object), gives a name to the resulting object, runs the suite of statement that follows (and indented block of statements is called a "suite" in Python) and NO MATTER HOW THE SUITE ENDS it will call the close() method on that object. This means you can't forget to close the file, and you don't have to remember. Python does it for you when control leaves that suite.
That NO MATTER HOW bit is important enough to shout; and it also lets you simplify the function, using another bit of Python you probably hadn't learned before now:
def loadFile(fname):
.... with open(fname, 'r') as ifile:
.... .... return ifile.readlines()
That's it. Python file objects have a method to do exactly what your for loop did...read all of the lines into a list.
You'll still use "for line in infile:" type loops. Those are very handy when filtering input, such as only including selected lines, or modifying lines before storing them. For example, one common thing to do is to remove trailing '\n' characters.
def load_file(fname):
.... """Reads named file into a list of strings, removing newlines."""
.... result = []
.... with open(fname, 'r') as ifile:
.... .... for line in infile:
.... .... .... if line.endswith('\n'):
.... .... .... .... result.append(line[:-1])
.... .... .... else:
.... .... .... .... result.append(line)
.... return result
The last two flourishes were to add a "docstring" and rename the function.
A docstring is a string constant as the first line of a definition of an object (functions are objects....EVERYTHING in Python is an object!) and gives it a field named __doc__ that is supposed to tell a human about the object. It's a good place to put a brief description of the function. Editors in IDEs like Idle or PyCharm will will pop up those helpful descriptions as you are editing, if the definitions are available.
I also switched to python_preferred lowercase names with underscores rather than camelCaseWithInteralCaps that languages like Java prefer. Use what you like. I tend to follow the style of the folks that wrote the standard libraries, figuring they know more about the language than I do. Python prefers to use TitleCaseNames (with a leading capital) for class names. You'll find out about defining your own classes later.