r/learnpython • • 16d ago

what can I use python for?

Lately, I've been thinking about learning a new programming language. Python was the first one that came to mind, but then I started wondering: What would I actually use it for?

I already build mobile apps with Flutter and dynamic web applications using PHP and MySQL.

I'm always looking for something new to learn, but I also want to make sure I'm learning something I can actually put to use.

0 Upvotes

27 comments sorted by

View all comments

4

u/Discordbothost 15d ago

since you already have php + mysql apps, the most useful first thing is the stuff around them, not replacing them. stuff like a script that connects to the same mysql db, pulls last week's orders/users into pandas and spits out a csv or chart for whoever keeps asking you for numbers. or a cron job that cleans up old rows, checks your sites are up, resizes uploads, whatever you're currently doing by hand or in a messy php cli script.

import pandas as pd
from sqlalchemy import create_engine

eng = create_engine("mysql+pymysql://user:pass@localhost/shop")
df = pd.read_sql("select * from orders where created_at > now() - interval 7 day", eng)
print(df.groupby("status").total.sum())

that's 5 lines for something that's annoying in php. once that clicks, scraping, small fastapi services and ml stuff are the same language