def get_keys_from_shelve ( file_name , file_location ) : temp_list = list ( ) file = __os . path . join ( file_location , file_name ) shelve_store = __shelve . open ( file ) for key in shelve_store : temp_list . append ( key ) shelve_store . close ( ) return temp_list
python get shelve keys
Function to retreive all keys in a shelve Args : file_name : Shelve storage file name file_location : The location of the file derive from the os module
def get_keys_from_shelve(file_name, file_location):
    """
    Function to retreive all keys in a shelve
    Args:
        file_name: Shelve storage file name
        file_location: The location of the file, derive from the os module

    Returns:
        a list of the keys

    """
    temp_list = list()
    file = __os.path.join(file_location, file_name)
    shelve_store = __shelve.open(file)
    for key in shelve_store:
        temp_list.append(key)
    shelve_store.close()
    return temp_list