object

python – split query results into multiple objects based on one column

python – split query results into multiple objects based on one column Question: my program is querying a sqlite database, and thre result is like this (simplified) in the cursor ready to be fetched. connection = sqlite3.connect(IMAGE_LOG_DB_PATH) connection.isolation_level = None cur = connection.cursor() sql_query = "Select date, name, count(*) as sells from sellers group by …

Total answers: 1

error, center argument must be a pair of numbers. newbie

error, center argument must be a pair of numbers. newbie Question: Just trying to draw a circle within a window as a player class, but having some trouble. Can’t get past this error, looked up other posts on the issue but to no avail. Understood that error stems from the need for x,y to be …

Total answers: 2

Struggling to print objects in Python using list comprehension

Struggling to print objects in Python using list comprehension Question: I am learning Python for the first time and am trying to build a full fledged object oriented program, based on a childhood nursery rhyme/game about counting fists (Bubblegum Bubblegum in a Dish…) I have a class/Player object, which has fists as an attribute. There …

Total answers: 1

want to genertate complex desired list of object using list and python

want to genertate complex desired list of object using list and python Question: I want to generate data based on some rules and on in the unique structure can’t know how to do it, any help would be appreciated it i have two list: categories = [ ‘fruits’ ‘meats’ ] and another list is : …

Total answers: 1

Pass instance attribute as a decorator parameter

Pass instance attribute as a decorator parameter Question: I am creating a class Encuesta to create multiple surveys via user commands for a discord bot using discord.py. To achieve this, I have to pass the attribute "self.buttonid" as the ‘custom_id’ parameter for the decorator @discord.ui.button (already defined by discord.py). class Encuesta(discord.ui.View): def __init__(self, pregunta, buttonid): …

Total answers: 1

Deleting elements from list or recreating new list (python)

Deleting elements from list or recreating new list (python) Question: What it the best/fastest way to delete objects from list? Deleting some objects: [objects.remove(o) for o in objects if o.x <= 0] or recreating new object: new_objects = [o for o in objects if o.x > 0] Asked By: Scott || Source Answers: For starters, …

Total answers: 2