def make_folder_for_today(log_dir):
    """Creates the folder log_dir/yyyy/mm/dd in log_dir if it doesn't exist
    and returns the full path of the folder."""
    now = datetime.datetime.now()
    sub_folders_list = ['{0:04d}'.format(now.year),
                        '{0:02d}'.format(now.month),
                        '{0:02d}'.format(now.day)]
    folder = log_dir
    for sf in sub_folders_list:
        folder = os.path.join(folder, sf)
        if not os.path.exists(folder):
            os.makedirs(folder)
    return folder
def make_folder_for_today ( log_dir ) : now = datetime . datetime . now ( ) sub_folders_list = [ '{0:04d}' . format ( now . year ) , '{0:02d}' . format ( now . month ) , '{0:02d}' . format ( now . day ) ] folder = log_dir for sf in sub_folders_list : folder = os . path . join ( folder , sf ) if not os . path . exists ( folder ) : os . makedirs ( folder ) return folder
Creates the folder log_dir/yyyy/mm/dd in log_dir if it doesn't exist
    and returns the full path of the folder.