547 questions from the last 30 days
11
votes
3
answers
412
views
Multithreading becomes much slower than multiprocessing in free-threaded Python
Consider the following executable Python script mtmp.py:
import numpy as np
import os
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
# `x` is referenced `n_loop` times.
def ...
Advice
0
votes
12
replies
137
views
List numbering through loop
I am trying to create a 3 x 3 kind of matrix where I create 3 lists and append 3 random values to it so that when I print the 3 lists, it looks like a 3 x 3 matrix of random numbers.
import random
...
Advice
0
votes
7
replies
142
views
Could this unit conversion code in Python be shortened?
Just started a week or 2 ago with Python, no rigid schedule just practicing leniently and I finally made a calculator which converts one unit to the other in the metric system.
If there is any ...
Advice
1
vote
6
replies
145
views
What is the use of class
I'm a newbie to Python.I am currently completing one of my assignments. I'm currently learning about classe, but I'm quite confused. Don't classe just do some sort of classification? Why is it said ...
Advice
0
votes
8
replies
183
views
Finding the max values for list values for each key in a dictionary without using max()
Let's say I have a dictionary such as:
dict = { "Mars": [4, 3, 4, 7, 10], "Jupiter": [6, 6, 7, 9, 11], "Saturn": [4, 5, 12, 22, 1]}
I would like to iterate through each ...
Advice
1
vote
7
replies
202
views
Best sites to gather cheat-sheets/notes
I am someone who likes to study via online notes and documentation, but I would really like it if there were a website with a collection of short notes and/or cheat sheets so that I can revise the ...
Advice
2
votes
6
replies
152
views
Is () a standard for starting a function?
After learning Python for a while, I feel that () is a standard for starting functions. If I don't add () after the function, the function won't run even if it doesn't have parameter imports, so I ...
5
votes
3
answers
247
views
How to query columns that are lists or dicts?
How can I query columns that are lists or dicts? Here is some basic JSON-like data.
[
{
"id": 1,
"name": "John Doe",
"age": 30,
&...
2
votes
1
answer
1k
views
pyodbc INSERT FROM CSV stopped working in Access - "Operation not supported for this type of object"
I recently (as of November 2025) had some working SQL via pyODBC to import an existing CSV file to a table in an Access database.
cursor.execute(f"""
INSERT INTO [{table_name}] ([Date], ...
2
votes
1
answer
2k
views
ResourceExhausted: 429 with "limit: 0" on Gemini API Free Tier (LangChain) even after new project
I am trying to use the Google Gemini API with langchain-google-genai in Python. I want to use the Free Tier, so I created a fresh project in Google AI Studio (without linking any billing account).
...
Tooling
0
votes
5
replies
134
views
Is there a tkinter editor suitable for beginners
I am a newbie in Python. My assignment requires me to use a graphical interface, and I plan to use tkinter for this purpose. However, I find manually typing code too complicated. Could any expert ...
3
votes
2
answers
144
views
How many video IDs can I pass in a videos.list request for the YouTube Data API v3?
I am using the videos.list endpoint of the YouTube Data API v3 to request information about multiple YouTube videos at once.
The documentation states the id parameter "specifies a comma-separated ...
4
votes
2
answers
171
views
Regex - How do I check for digits 01 to 52 in filenames?
I have found the answer :-)
It is: ^ghf(0[0-9]|[1-4][0-9]|5[0-2])\d{3}[A-Z]{2}_v\d{2}.pdf$
I receive filenames from a client that are structured according to the following scheme:
ghf50001BE_v02.pdf
...
Best practices
0
votes
12
replies
207
views
Coding Help/guidance
I find it difficult to code (in python) without ChatGPT sometimes - and I'm not great at using documentations and learning, i feel like chatGPT explains things better. Could you guide me as I aspire ...
Advice
0
votes
4
replies
168
views
I'm a beginner learner and i'd like some feedback on this really simple program calculating an employee's pay
hours = input("Enter hours: ")
try:
hours = float(hours)
except:
print('Please enter a valid number')
quit()
rate = input("Enter rate: ")
try:
rate = float(rate)
...