About 266,000 results
Open links in new tab
  1. Python dictionary from an object's fields - Stack Overflow

    Sep 15, 2008 · First, Python generally shuns callings dunder items directly, and there is almost always a method or function (or operator) to access it indirectly. In general, dunder attributes …

  2. How to convert a nested Python dict to object? - Stack Overflow

    690 I'm searching for an elegant way to get data using attribute access on a dict with some nested dicts and lists (i.e. javascript-style object syntax). For example:

  3. In python, how do I cast a class object to a dict - Stack Overflow

    Feb 9, 2016 · Your question is misleadingly phrased, you don't want to convert or cast your object to dict representation (such that you could completely recover the object if you converted …

  4. dictionary - Is Python dict an Object? - Stack Overflow

    Jul 20, 2013 · Etc. There are no constants in Python. no i meant class constant. sorry I wrote it wrong. What I meant, attribute means, something which does some kind of operation on an …

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

    Mar 1, 2017 · This gives you an object which still behaves like a dict, but also lets you access keys like attributes, in a much more rigid fashion. The advantage here is I (or the hapless …

  6. Accessing dict_keys element by index in Python3 - Stack Overflow

    In Python 3, the dict.keys() method returns a dictionary view object, which acts as a set. Iterating over the dictionary directly also yields keys, so turning a dictionary into a list results in a list of …

  7. python - Converting dictionary to JSON - Stack Overflow

    Nov 5, 2014 · The title would be more clearer if it could say - "Converting dictionary to JSON string" because sometimes it's not implied by default.

  8. python - Dictionary vs Object - which is more efficient and why ...

    What is more efficient in Python in terms of memory usage and CPU consumption - Dictionary or Object? Background: I have to load huge amount of data into Python. I created an object that …

  9. In Python, what is the difference between an object and a …

    Aug 19, 2011 · Afaik, a method is an object that has a function and an object it is bound to. So I could create a method from a function and a dictionary, and store it in that very dictionary, thus …

  10. python - What are dictionary view objects? - Stack Overflow

    In python 2.7, we got the dictionary view methods available. Now, I know the pro and cons of the following: dict.items() (and values, keys): returns a list, so you can actually store the result, and