About 66,400 results
Open links in new tab
  1. Python, creating objects - Stack Overflow

    Feb 26, 2013 · The so called "factory method" pattern, the one where you use a method or a function to create object of some kind instead of creating them directly in the code, is a useful …

  2. How to create multiple class objects with a loop in python?

    Suppose you have to create 10 class objects in python, and do something with them, like:

  3. python - How to dynamically build a JSON object? - Stack Overflow

    I am new to Python and I am playing with JSON data. I would like to dynamically build a JSON object by adding some key-value to an existing JSON object. I tried the following but I get …

  4. python - How to create a list of objects? - Stack Overflow

    Aug 15, 2020 · 5 The Python Tutorial discusses how to use lists. Storing a list of classes is no different than storing any other objects.

  5. python - How can I create an object and add attributes to it?

    May 13, 2010 · I want to create a dynamic object in Python and then add attributes to it. This didn't work: obj = object() obj.somefield = "somevalue" AttributeError: 'object' object …

  6. Create an Array of objects in Python - Stack Overflow

    Feb 1, 2015 · 0 I'm trying to make a list of objects in python. I'm doing this by making one object You simply can't do this; your second statement contradicts your first statement. You must …

  7. How can I create a copy of an object in Python? - Stack Overflow

    Jan 25, 2011 · 173 How can I create a copy of an object in Python? So, if I change values of the fields of the new object, the old object should not be affected by that. You mean a mutable …

  8. how to dynamically create an instance of a class in python?

    Depends of the context, if cName comes from some input from a user, it's dangers because a hacker can inject Python code there: it's true, but many times you only need this to setup your …

  9. How to create a new unknown or dynamic/expando object in Python

    Dec 24, 2012 · In python how can we create a new object without having a predefined Class and later dynamically add properties to it ? example: dynamic_object = Dynamic() …

  10. python - Create an object without calling a class - Stack Overflow

    Jan 21, 2012 · 33 In Python you can add members dynamically to an object, but (1) the name must already exist (it must have been assigned) and (2) it must be bound to an instance of …