Ask Documentation
WebsiteGitHubPyPI
  • Introduction
  • Getting Started
    • Install & Get Started
    • Hello, World!
  • Routes & Requests
    • Routes
    • Defining Routes
    • Request Data
    • HTTP Status Codes & Methods
    • CORS
  • Response
    • JSON Response
    • JSON Response With an HTTP Status Code
  • Classes
    • Class Instance Variable
    • Initialization/Constructor Method
  • Data Types
    • Dictionaries
  • Built-in Utilities
    • Quick_set()
    • Deep()
    • Serialize()
    • Require_keys()
    • Random Generators
    • Pattern Matching
    • Email
  • Database
    • Ask and Databases
    • Models/Classes
      • Columns
      • Initialization/Constructor
      • Serialization
      • The &basic decorator
    • CRUD
      • Add
      • Select
      • Update
      • Delete
    • Check if a Row Exists
    • Sorting
    • Database Lists
  • JWT Authentication
    • Introduction
    • Protecting Routes
    • How to Create a Basic Login System
    • Properties & Methods of _auth
    • Making Requests to Protected Routes
  • Decorators
    • What are Decorators?
    • Create and Use Custom Decorators
    • Built-in Decorators
  • Security
    • Hashing
    • Route Security
    • Environment Variables
  • Configuring the Transpiler
  • Askfile.toml
  • Modules & Libraries
    • Importing an Ask Module
    • Includes
    • Importing Python Modules
  • Development Tools
    • Editor Syntax Highlighting
    • Automatic API documentation
    • CLI Flags
    • Running in development mode
    • Versioning System
  • Contribute
    • Feature Requests
    • Bug Reports
    • Contribute Code
Powered by GitBook
On this page
  • Usage
  • Parameters:
  • Example
Export as PDF
  1. Built-in Utilities

Deep()

Find a dictionary in a list of dictionaries by value.

Deep() returns a dictionary from a list of dictionaries by value. This can be useful when you need to pick out e.g. a product by id from a list of products represented by dictionaries.

Usage

deep(..., search requirements)

Parameters:

  • A list.

    • That contains only ditionaries.

  • A dictionary

    • With the key & value to search for.

Example

products = [
    {
      id: 1,
      title: 'Product 1'
    },
    {
      id: 2,
      title: 'Product 2'
    },
    {
      id: 3,
      title: 'Product 3'
    }
]

# Get the product with the id of 2.
selection = deep(products, {id: 2})
PreviousQuick_set()NextSerialize()

Last updated 4 years ago