About 975 letters

About 5 minutes

#dict

Description: Type conversion to dict.

def dict(**kwarg):
    '''
    Type conversion to dict

    :param kwarg: Key-value pairs
    :return: The value converted to dict
    '''

def dict(mapping, **kwarg):
    '''
    Type conversion to dict

    :param mapping: A mapping object
    :param kwarg: Key-value pairs
    :return: The value converted to dict
    '''

def dict(iterable, **kwarg):
    '''
    Type conversion to dict

    :param iterable: An iterable containing key-value pairs
    :param kwarg: Key-value pairs
    :return: The value converted to dict
    '''

Example:

print(dict(name='Alice', age=18))
print(dict({'name':'Alice', 'age':18}, sex='female'))           # mapping
print(dict((('name', 'Alice'), ('age', 18)), sex='female'))     # iterable

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025