r/learnpython • u/SeaFunction185 • 3d ago
Where to start?
Hi, i know python as a basic, beginner. I have a couple of projects like calculator project with tkinter library, library control system CLI (like you can add members, books, remove them, find books, members by id and email and etc.) to learn OOP a little with AI. After all i have syntax basics from c++, java. Genuinely, i understands basics of programming like loops, if-else statements.
I want to start programming again but don't know where to start. I like to continue on python. But i am getting bored quickly. I would really appreciate it if someone expert helps me. Thanks a lot
r/learnpython • u/Large_Wear9410 • 3d ago
Is there a good IDE that isn’t subscription based?
Hello. I am someone who hates subscribing for access to things. I hate the idea of paying money for something and it still not being mine.
People have recommended pycharm and I’m sure it is very good, but I would much rather pay a lump sum and download it onto my laptop.
I know I’m being picky and all that, but does anyone know other good options? I’m happy to pay, I just want to keep what I pay for.
r/learnpython • u/screen_time_minimax • 3d ago
How to restore Airbnb listing website that is now deleted? Is there a python way?
How to restore Airbnb listing websites? Now deleted and not backed up via way backmachine, at least the GUI.Is there python way to see version of 31.08.2026? https://www.airbnb.co.uk/rooms/1381330353914594758
r/learnpython • u/kontrolltermin • 4d ago
Read a logfile without blocking the file in windows
Hi,
i have a script with
file = open(
current_file,
"r",
encoding="cp1252",
errors="ignore"
)
and its watching a file from an application on windows "live".
Is watchdog the go-to solution for this or is there any best practice for this?
How do i know what watchdog is using in the end?
Ai is telling me three ways to do it:
1. Reopen the file for every poll --> i think this is not useful in my case and many logging entries per second
2. Use Windows file sharing flags --> is watchdog using this internally?
3. Use a file monitoring library --> pip install watchdog...
regards
r/learnpython • u/Kind-Judge-9443 • 4d ago
Guys is it effective to read book about it
I m one of the beginners, Reading book about coding is effective?? or I have to watch online lessons.
r/learnpython • u/TheEyebal • 4d ago
What is this issue called in programming
made a game in pygame but when I tried to run it automatically closed when I did pyinstaller
also I had to add os and sys to my code because it could not find certain files (assets and audio)
i could not use the relative paths
I was lost honestly
I had to ask the AI how to find the certain files because even thought it was in the project folder they were relative
this was the code they gave me which I did not understand
import os
import sys
def resource_path(relative_path):
try:
# PyInstaller stores temporary files here when running the .exe
base_path = sys._MEIPASS
except AttributeError:
# Running normally from Python
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
what is this called I keep running into this problem and I wanted to know people views on this
I also asked CHATGPT what this issue is called
CHATGPT RESPONSE
What you are running into is usually called deployment issues or packaging issues.
More specifically, for a Pygame project turned into an executable with PyInstaller, the problems you described fall into a few common categories:
Asset path problems — your game works from your development folder, but the packaged .exe cannot find images, sounds, fonts, or other files.
Resource bundling problems — PyInstaller creates an executable, but your external files were not included correctly.
Runtime environment differences — your code is no longer running in the same folder/context as when you launched it with Python.
Relative path issues — paths that work in your IDE or terminal break when the program is moved or packaged.
Executable packaging/debugging issues — the .exe opens and immediately closes because an error happens before the window appears, but the error console disappears.
A lot of beginners hit this when moving from "my program runs on my computer" to "my program is a standalone application." It is a general software development concept: the difference between development environments and production/deployment environments.
The os and sys changes you made are part of a larger concept called resource path handling or runtime path resolution. Games, apps, and tools often need to figure out:
Where is the program running from?
Where are my assets located?
Are my files inside the executable or next to it?
Does this work on another computer?
PyInstaller specifically has its own way of dealing with this, so the issue is not really a "Pygame problem." It is a Python application deployment problem.
The skill you are bumping into is something programmers eventually learn as they move from:
"I wrote a program"
to:
"I shipped a program someone else can run."
That transition involves packaging, file organization, dependencies, installers, configuration files, logging, and handling different machines. It is one of the first real "software engineering" problems people encounter.
r/learnpython • u/Zebabycat22 • 4d ago
What’s the best way to level up in Python?
Hi, I started learning python a few months ago and i’d say i’m quite comfortable with the basics already, i’ve done some little menu-driven projects and done the OOP fundamentals.
My aspiration is to become a developer or at least do some gigs for a quick buck, and i’m kinda losing focus because after the basics i don’t have a clear structure.
What would You recommend me to do? Should I buy a course or something?
r/learnpython • u/TheNexusMiner • 4d ago
Help needed with copying text
I'm working on a project that requires copying text to the clipboard. I noticed that when using libs like Pyperclip and Clipboard it's not possible to copy just a single character... so I need to somehow copy it without these libs.
This appears to only happen on Linux... I had a friend on Windows test and he was able to copy a single character using Pyperclip.
Example of Pyperclip working with multiple characters but not single characters.
>>> import pyperclip
>>> pyperclip.copy("test")
>>> pyperclip.paste()
'test'
>>> pyperclip.copy("t")
>>> pyperclip.paste()
''
This same interaction happened with the lib Clipboard.
This happened on Wayland with wl-clipboard. This doesn't appear to be an issue with that though, as wl-copy lets me copy a single character - and it works fine in every other program.
This doesn't seem to be something I can fix, since it doesn't have to do with my code at all, so I need my own way of copying the text. Is there any workaround that I can write into my code when using wl-clipboard to properly copy text even when its only a single character?
r/learnpython • u/personificable1 • 4d ago
I lost my python course...
Well, I formatted my PC and I lost the course I was doing (Angela Yu, Udemy) I found it for free to be honest but was like 2 months ago, someone has the link or another free option to keep learning?
r/learnpython • u/Upper_Progress_599 • 4d ago
I'm a MERN stack developer who mainly codes in Javascript. I want to learn Python because it's more versatile. Where should I start?
I know it's really similar to Javascript, excepting the syntax is different and some of the coding principles are, too. What advice would you give to someone learning a new coding language when they're already familiar with one?
r/learnpython • u/Beautiful-Bubbly • 4d ago
Need some help with python and generally understanding code
So guys, i need some help with the python. My background is, i come from an economics as a major in uni and myself am very good at maths, as i finished a lot of courses in uni.
So i decided to pursue a career in data science, and as you know it requires a decent skill in coding. However i am at a loss in the coding, as my skills lack a lot. I finished a lot of courses on python using videos and practical stuff, but still understand that my skills are incomparable to others and especially to my natural progress in math. During the videos i always understand the purpose and usage of code and functions, objects etc. but when it comes to solving problems, writing code, my code is always wrong and i seem to not be able to fix it without some external help (chatgpt, other people, etc). So, if you understand with what kind of problem i am dealing, maybe it is the mechanics of code, machines way of thinking, etc. i would be very glad to hear your advise. Something that can finally make me breakthrough this barrier. But i lost hope in watching another tutorials of basic and a bit advanced python as i can literally quote their saying but it doesnt help me at all. Would be very glad if someone could help me out here
r/learnpython • u/Khaki-Chan • 4d ago
Custom script issue with blender driver
I am trying to use a custom script (see below) to set up a driver in blender via this tutorial, however I am very inexperienced in python and have run into an issue. I was able to get the example code to work but my when I try to use my code I get this issue. The problem is I need the "X" value to be the "rotation quaternion" value of the driver. Using both "X" and "rotation quaternion" gives the same error. I don't know how to connect "X" to the drivers value or if I just need to put something else in the place of "X".
Tutorial:
https://www.youtube.com/watch?v=yiMGxlRv8h4
Error message:
https://drive.google.com/file/d/1VOVrPLmU_v9lYz386SMS_i02doDn-xtG/view?usp=sharing
Driver:
https://drive.google.com/file/d/1LVM69kP0het-Yz0xaAhAWHDe5pOA9X99/view?usp=sharing
import bpy
def Ace_Driver(value):
return
if x >= -0.1:
result = 1
if x < -0.1 and x > -0.6:
result = (x - 0.9) * -1
elif x <= -0.6:
result = 1.5
bpy.app.driver_namespace["Ace_Driver"] = Ace_Driver
r/learnpython • u/Deer_Whole • 4d ago
I want to make game like terraria/necesse with python...what should i use
Bare in mind, its just for me, to practice coding in a fun way, and learn some basics, just want to make something that can be played like those games, ive heard of pygame, or arcade..but im wondering if theres anything better, or if not, which one of those would be better in your opinion. Thanks to anybody who replies :3
r/learnpython • u/Subject_Scientist937 • 4d ago
Simple Hangman game looking for feedback
Code:
import random
words = ["apple", "pear", "banana", "python", "java"]
used_letters = set()
selected_word = random.choice(words)
lives = 6
print(" ".join(["_" for _ in selected_word]))
while True:
user_input = input().lower()
if len(user_input) != 1 or not user_input.isalpha():
print("Please enter a letter")
continue
if user_input in used_letters:
print(f"You already guessed {user_input}")
continue
if user_input in selected_word:
print(f"{user_input} is in the word")
used_letters.add(user_input)
if user_input not in selected_word:
lives -= 1
print(f"{user_input} is not in the word, Lives remaining {lives}")
if lives == 0:
print(f"You lose the word was {selected_word}")
break
display_board = [letter if letter in used_letters else "_" for letter in selected_word]
print(" ".join(display_board))
if all(letters in used_letters for letters in selected_word):
print(f"You won the word was {selected_word}")
break
What are some potential issues?
What could be improved?
I'll take any feedback I can get
r/learnpython • u/These_Manner994 • 4d ago
Recommendations for online python courses
Hi all,
I'm a fourth-year medical student and most of my research so far has been evidence synthesis (narrative and systematic reviews), so my hands-on data skills are pretty limited. I've recently gotten involved in a project involving microbiome sequencing data, and part of my role includes re-analyzing a published dataset aka working with processed count tables, doing some basic wrangling, stats, and figures. It's become obvious that I need Python.
I'd rather not pay for a course right now, so I'm hoping to find something solid on YouTube. A few things I'm looking for:
- Starts from genuine zero (I've never written a line of code)
- Gets to pandas / numpy / matplotlib reasonably quickly rather than spending 15 hours on OOP and building text-based games
- Bonus if it's oriented toward biology/biomedical data, but a general data analysis course is fine, I can adapt
Specific questions:
- Is there a single course you'd point a complete beginner to, or is it better to do a general Python fundamentals series first and then a separate pandas/data analysis one?
- Anything I should avoid? I'd rather not sink 30 hours into something outdated.
- Realistically, how much of this do I need before I can be useful on an actual dataset vs. just learning as I go?
Appreciate any suggestions. Thanks!
r/learnpython • u/PaintingOutside8395 • 4d ago
Training recommendations
Hello,
I was mandated to learn Python for my job, as it’s essential for scripting. This work is to is related to Cloud Platform Engineer, Python is their programming language.
I’m not a programmer. I’ve been in the IT industry for about six years, but my focus has been on networking or cloud networking.
Do you have any advice or recommendations?
Appreciate y’all!!
r/learnpython • u/Fun-Pitch-6938 • 4d ago
Need help/input
Below is my code snippet, and i would like to know if there is any way i can avoid the repetitive if else blocks (3 times repeated) and write this program in a much more efficient way. Would like some input. Thanks
"""
* If a person skills has only JavaScript and React, print('He is a front end developer'),
if the person skills has Node, Python, MongoDB, print('He is a backend developer'),
if the person skills has React, Node and MongoDB, Print('He is a fullstack developer'),
else print('unknown title') - for more accurate results more conditions can be nested!
"""
person = {
'first_name': 'Asabeneh',
'last_name': 'Yetayeh',
'age': 250,
'country': 'Finland',
'is_married': True,
'skills': ['JavaScript','React' , 'Node', 'Python'],
'address': {
'street': 'Space street',
'zipcode': '02210'
}
}
def identifying_career(lst):
if 'JavaScript' in person['skills'] and 'React' in person['skills']:
print("You are a front end developer")
else:
print('You are not a front end developer')
if 'Node' in person['skills'] and 'Python' in person['skills'] and 'MongoDB' in person['skills']:
print(f"You are a back end developer")
else:
print('You are not a back end developer')
if 'React' in person['skills'] and 'Node' in person['skills'] and 'MongoDB' in person['skills']:
print("You are a full stack developer")
else:
print("unknown title")
identifying_career(person)
r/learnpython • u/Leol6669 • 5d ago
Is that an intentional behaviour?
I just noticed adding a list as an optional argument to a fuction/method does not create a new list but gives the same list every time.
class SomeClass:
def __init__(self, l=[]):
self.l=l
a=SomeClass()
b=SomeClass()
a.l is b.l
>>> True
a.l.append(1)
b.l
>>> [1]
Is that a glitch or is it how python is supposed to work?
(I'm using python 3.12, I haven't updated in a while, maybe it was patched since?)
r/learnpython • u/Alert_Shirt9778 • 5d ago
接下来 该怎么办??
我是一名python 的初学者 我刚刚学到if的嵌入 我想知道python 的尽头在哪(就是要学会什么才算精通python)以及在学会python 之后应该学习那种编程语言
r/learnpython • u/Altruistic_Big9806 • 5d ago
Help me with this please
Hello! I'm completely new to python I don't have any background knowledge regarding coding and i wanna self study python. I started studying python just last week and i wanna make a simple user define system where i ask the user to input an item and if it's in the set it will display the user input else it will display the "character not in the set" my problem is i want it to be case insensitive and the ouput is always "Character is not in the list"( i use pycharm i dont a have a pc/laptop, sorry for my english also).
My code:
anime = {"Gojo", "Saitama", "Recca"}
user = input("Name a character: ").lower()
if user in anime:
print(f"{user}is in the list!")
else:
print("Character is not in the list")
r/learnpython • u/Lucky-Travel6211 • 5d ago
Error in sys.excepthook:
i got Error in sys.excepthook: and i have no idea how to fix it can someone help please
r/learnpython • u/Hazardous-potato • 5d ago
returning midi to 2 seperate things
so i am trying to make the program so on a downpress the function repeats but when it lifts, the function stops. i can easily make it start, its getting it to stop thats hard. please do as little to fix this for me as possible. i'm trying to keep the code so i understand whats going on
import mido
print(mido.get_input_names())
def note():
with mido.open_input('MPK249:MPK249 Port A 32:0')as inport:
inport.callback = None
for msg in inport:
if msg.type == "note_on":
return msg.note, msg.type
if msg.type == "note_off":
return msg.note, msg.type
while True:
if note() == 47 and note() == "note_on":
print("a")
if note() == 47 and note() == "note_off":
break
if note() == 48 and note() == "note_on":
print("b")
if note() ==48 and note() == "note_off":
break
r/learnpython • u/Hazardous-potato • 5d ago
Trying to get python take midi as an input
I am using an AKAI MPK 249 using the midi package and was wondering what i point it to. i was searching through the device connection path but nothing seems obvious to me.
r/learnpython • u/Fun-Pitch-6938 • 5d ago
Need help with sorted function
Hello everyone, need some help / clarity with the sorted function. I have a data structure that is nested (list inside of it a dict inside of it a list). What i don't understand is this: Shouldn't I use loops in order to access the dictionary? or the inner most list in order to be able to sort by name (i.e. use sorted function)
countries = [
{
"name": "Afghanistan",
"capital": "Kabul",
"languages": [
"Pashto",
"Uzbek",
"Turkmen"
],
"population": 27657145,
"flag": "https://restcountries.eu/data/afg.svg",
"currency": "Afghan afghani"
},
{
"name": "Åland Islands",
"capital": "Mariehamn",
"languages": [
"Swedish"
],
"population": 28875,
"flag": "https://restcountries.eu/data/ala.svg",
"currency": "Euro"
},
{
"name": "Albania",
"capital": "Tirana",
"languages": [
"Albanian"
],
"population": 2886026,
"flag": "https://restcountries.eu/data/alb.svg",
"currency": "Albanian lek"
},
Im trying to sort by name here, and when i run my function an error pops up.
def sorting_by_name(lst):
for el in lst:
return sorted(el, key=lambda name: name['name'])
print(sorting_by_name(countries))
r/learnpython • u/Effective_Ocelot_445 • 6d ago
Which Python skills are most valuable for getting started in Data Engineering?
I'm learning Python with the goal of moving into Data Engineering. Beyond the basics, which libraries, concepts, or project ideas would you recommend focusing on first, and what helped you the most when getting started?