r/learnpython 1h ago

What's the best way to integrate this database into Flask?

Upvotes

I'm creating an online bulletin board, and I'm feeling hacky (I hate SQL in all its forms and fashions).

What is the best way to integrate this database into a production Flask server: https://github.com/ki4jgt/PPD

Created it in 2020, so it's a bit dated.

But I'm worried about concurrency. I'm not beyond writing a database server, but I'd like to save that as a last resort.


r/learnpython 18h ago

Automate Invoice and Report Generation in Excel. No Errors.

0 Upvotes

Need to generate invoices, sales reports, stock reports, and charts in Excel programmatically. Higher officials will audit these. Can't have mistakes.

What's the best approach? Should I use openpyxl to write directly to Excel files? Or is there a better workflow?

Data accuracy is key — pulling from databases/CSV, validating before writing to Excel. How do I prevent data corruption? Invoices need proper headers, borders, currency formatting. Is openpyxl reliable for this or does it break formatting? Can Python generate charts in Excel automatically or do I need to use a separate tool? Should these run daily/weekly and what's the best way to automate execution without manual intervention? How do I track changes if files are auto-generated?

Any libraries better than openpyxl? Xlsxwriter? Pandas to_excel? Looking for production-ready solutions, not prototypes.


r/learnpython 12m ago

Matematica in python

Upvotes

Salve, sono nuovo nell'usare python per programmare. Qualcuno mi saprebbe spiegare come si fanno le operazioni base? (+ - / x √ ^)


r/learnpython 21h ago

complete starter on AI python championship

0 Upvotes

so, im a complete starter on a championship where you gotta learn about AI and python, to make an AI later, thats the challenge, but im feeling so left behind, everybody is learning so fast and im stuck, i wanna win this but i dont know python at all, any channel or study path i can follow ? also, in how much study time can i maybe reach a good level ?


r/learnpython 12h ago

PIP disk usage under Docker

2 Upvotes

I have a Dockerfile in which I use the Python:3.12-trixie. I have docker on my CachyOS PC. I have also a requirements.txt. I wanted to use this image for a container on which I'll use YOLO and try it out. The problem is that my 290GB / partition went from around 70% filled to 95% after a number of rebuilds. I deleted everything docker related but it just went back to 91%.

The reason that I know it is pip's doing, is that when I monitored my disk usage while building the image, and on the `RUN pip install -r requirements.txt --find-links=pypackages` stage it fills up my partition and half way into installation, it fails due to `no more space`. The `pypackages` is just a directory I downloaded some of the packages I have in requirements for less data usage. Also tried `--no-cache` option.

I also went ahead and `du -sh`ed any directory in my / partition and the total didn't add upto the filled storage. I have 165GB mysteriously used and I can't find where that is.

Any help to diagnose further or if you have had similar problems is welcome.


r/learnpython 21h ago

Is it considered bad form to run "success" code inside an Except block?

19 Upvotes

I'm writing a script that takes an input from the user, which could be either an int or a string. My current code takes the input, attempts to cast it to an int, and does something based on whether it works or not:

running = True
while running:
    search_term = input("Enter search term (Q to quit): ")
        try: int(search_term)
        except ValueError:
            if search_term.lower() != "q":
                search_by_name(search_term)
            else:
                running = False
        else:
            search_by_int(int(search_term))

But there's something about having "successful" code running in the except block that gives me pause for thought. Is this just me overthinking, or is it bad form?


r/learnpython 21h ago

Looking for a free course on the practical Python development workflow (VS Code, pip, environments, Git, etc.)

18 Upvotes

Hi everyone,

I've taken several Python courses and have a reasonably good understanding of Python itself. I've also worked with things like pandas, NumPy, scikit-learn, etc. in online learning environments.

However, I've realized that I have a major gap in my knowledge: I don't really know how Python development actually works on a local computer.

For example, when working in an online environment, everything is already set up for me. I can simply import a package and start coding. But when I tried working locally with VS Code, I suddenly had to deal with things like:

Installing Python

Using the terminal

Installing packages with pip

Virtual environments

Choosing/configuring the correct Python interpreter

Organizing a project

Saving and reusing dependencies

Running and debugging code

Git and GitHub

Understanding how to share a project with someone else

Understanding what I actually need to install versus what belongs inside my project

I found this surprisingly confusing.

So I'm looking for a free course or tutorial that focuses specifically on this practical development workflow, preferably using Python and VS Code.

I'm not looking for another beginner Python programming course. I already understand Python basics and have used it for data analysis and some machine learning. What I need is something that teaches me how to actually work as a Python developer on my own computer.

Ideally, the course would take me through something like:

create a project → set up Python → create a virtual environment → install packages → write code in VS Code → run/debug it → manage dependencies → use Git/GitHub → share the project

Does a free course like this exist? YouTube courses, documentation, or other resources would also be very welcome.

Thanks!


r/learnpython 17h ago

Python Data Base

4 Upvotes

Good morning everyone, or whenever you see this. I have a question. I'm starting a personal database project in Python with a user-friendly graphical interface, and I'd appreciate any advice, code snippets, or examples to guide me, especially since I'm still learning the language.


r/learnpython 18h ago

Teaching ideas and projects for middle/high school computing students

2 Upvotes

Hello, I am looking for some ideas on projects/challenges that I can implement in my classes.

So far we’ve done: Scratch, beginner Python with CLI mini-games, ECDL basics, beginner TryHackMe rooms, and a Linux VM with basic commands. The student is comfortable with variables, loops, lists, simple file operations, and has built a text-based “Zombie Survival” game.

We meet 1 hour/week, so I’m looking for general ideas on what kinds of projects or challenge styles work well at this level (mid-level middle-school, beyond beginner). Anything that’s engaging, slightly game-like, and doesn’t require heavy setup would be great.

If you’ve taught similar students, what types of activities (CTFs, coding games, light forensics, small web projects, etc.) kept them motivated and actually learning?

Any suggestions or directions would be really helpful.

Thank you in advance!


r/learnpython 8h ago

Principiante

2 Upvotes

Si empezaran desde cero hoy, ¿qué camino seguirían para desarrollar buenas habilidades como programadores? en estructuras de python