Finding the latest file in a folder
First of all, I think that your variable names are quite good.


  Should I be returning False? Or 0?


I would recommend None

Don't repeat yourself

As you can see, the two branches of your if else are very similar.

Instead you could do a

if path is None:
    fullpath = file_pattern
else:
    fullpath = path + '/' + file_pattern


But joining paths like this is not very pythonic (and might cause problems on windows).

Instead, fullpath = os.path.join(path, file_pattern) is what you are looking for.

About the arguments

You can take inspiration of the os.path.join even further and change the order of your arguments (and completely remove the branching):

def get_latest_file(path, *paths):
    fullpath = os.path.join(path, paths)
    ...
get_latest_file('example', 'files','randomtext011.*.txt')


Use docstrings

And then you might think that the way to call it is not trivial and want to document it: let's use a docstring !

def get_latest_file(path, *paths):
    """Returns the name of the latest (most recent) file 
    of the joined path(s)"""
    fullpath = os.path.join(path, *paths)


Miscellaneous

If you use Python 3, you can use iglob instead.

For the os.path.split, I prefer using it like this (instead of the 1 index):

folder, filename = os.path.split(latest_file)


The import datetime is not used.

Instead of if len(list_of_files)&gt; 0:, you can simply do if list_of_files:

Revised code

def get_latest_file(path, *paths):
    """Returns the name of the latest (most recent) file 
    of the joined path(s)"""
    fullpath = os.path.join(path, *paths)
    list_of_files = glob.glob(fullpath)  # You may use iglob in Python3
    if not list_of_files:                # I prefer using the negation
        return None                      # because it behaves like a shortcut
    latest_file = max(list_of_files, key=os.path.getctime)
    _, filename = os.path.split(latest_file)
    return filename