I am not sure what you want to achieve here. But I think you might want to consider using http://docs.python.org/2/library/os.path.html#os.path.basename