About 50 results
Open links in new tab
  1. What does *tuple and **dict mean in Python? - Stack Overflow

    What does *tuple and **dict mean in Python? [duplicate] Asked 11 years, 10 months ago Modified 3 months ago Viewed 116k times

  2. python - What's the difference between dict () and {}? - Stack Overflow

    d = dict([['hash', 'bang'], ['slash', 'dot']]) And a whole other multitude of ways with the dict() function. So obviously one of the things dict() provides is flexibility in syntax and initialization. But that's not what …

  3. How do I merge two dictionaries in a single expression in Python?

    How can I merge two Python dictionaries in a single expression? For dictionaries x and y, their shallowly-merged dictionary z takes values from y, replacing those from x. In Python 3.9.0 or greater …

  4. Creating a new dictionary in Python - Stack Overflow

    Dec 8, 2011 · I want to build a dictionary in Python. However, all the examples that I see are instantiating a dictionary from a list, etc . .. How do I create a new empty dictionary in Python?

  5. python - How can I add new keys to a dictionary? - Stack Overflow

    Jun 21, 2009 · dict subclass that calls a factory function to supply missing values This is particularly useful if you are working with dictionaries that always consist of the same data types or structures, …

  6. How to initialize a dict with keys from a list and empty value in Python?

    How to initialize a dict with keys from a list and empty value in Python? Asked 15 years, 10 months ago Modified 2 years, 10 months ago Viewed 531k times

  7. What does `Dict[str, Any]` mean in Python? - Stack Overflow

    May 6, 2020 · The PEP 484 type Dict [str, Any] would be suitable, but it is too lenient, as arbitrary string keys can be used, and arbitrary values are valid. Could someone explain what does arbitrary string …

  8. python - How to index into a dictionary? - Stack Overflow

    137 Dictionaries are unordered in Python versions up to and including Python 3.6. If you do not care about the order of the entries and want to access the keys or values by index anyway, you can …

  9. python - Make a dictionary (dict) from separate lists of keys and ...

    new_dict = dict(zip(keys, values)) In Python 3, zip now returns a lazy iterator, and this is now the most performant approach. dict(zip(keys, values)) does require the one-time global lookup each for dict …

  10. python - Accessing dict keys like an attribute? - Stack Overflow

    Mar 1, 2017 · Python is like an inverted umbrella held high in heavy rain. It all looks smart and funky to begin with, after some time it begins to get heavy, then suddenly, you read some built-ins guru stuff …