r/learningpython • • Dec 15 '25

Need help with PyGithub Documentation

2 Upvotes

I'm new to python and have been ramping up recently. The information at realpython.com is invaluable!

I'm trying to make some GitHub integrations and am using the PyGithub api/package/module (I'm unsure of the nomenclature but you get it). I've not yet had too much experience with python api docs, but this seems a bit difficult to parse.

I'm able to eek by using the lsp to help describe the methods/signatures and attribs. But I do need help understanding how to read this documentation. I see some information using the examples, but it's leading to more questions than answers.

Edit: Specifically, I am having difficulty understanding how the chain of actions work. It is not very clear what methods return what, nor is it clear which methods take input, and what input it is.


r/learningpython • • Oct 11 '25

Why does the .bat file that runs my programs need to be in the same folder?

2 Upvotes

When I run a .bat file that isn't in the same folder as the .py file I'm running, the code gives me a "FileNotFoundError: [WinError 3] The system cannot find the path specified:" error. But when the .bat file is in the same folder, it runs with no issue. Can someone explain why? the error occurs on a call using os to list all the files in a folder. I even have the full paths listed for the python.exe and the python code in the batch file.

Full error:

 "File "C:\Users\<username>\Desktop\CBB Model\CBB_Test_2024-2025\3_track_stats.py", line 600, in <module>
file_list = os.listdir(halve_start_loc)
 FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\<username>\\Desktop\\CBB Model\\Schedule\\All Halves Adjusted\\Adjusted Halves\\'

Python Code here:

 import pandas as pd
 import numpy as np
 import re
 import os
 import pathlib
 from os import listdir
 import datetime as dt
 from datetime import timedelta
 pd.set_option("display.max_rows", None)
 pd.set_option('display.max_columns', None)
 pd.set_option('display.width', None)
 pd.options.mode.chained_assignment = None


 main_folder_loc = pathlib.Path().resolve()
 main_folder_loc = str(main_folder_loc)+ "\\"
 halve_start_loc = main_folder_loc + "Schedule\\All Halves Adjusted\\Adjusted Halves\\"

 halve_end_loc = main_folder_loc + "Schedule\\All Halves Adjusted\\Adjusted Halves with stats track\\"

 600 lines of functions and main

if __name__ == "__main__":
     file_list = os.listdir(halve_start_loc)  ##error occurs here
     main(file_list)

Batch Code Here:

  @echo off
  "C:\Users\<username>\AppData\Local\Programs\Python\Python314\python.exe" "C:\Users\<username>\Desktop\CBB Model\CBB_Test_2024-2025\3_track_stats.py"

r/learningpython • • Sep 13 '25

Want to learn Python, try out EasyDev: Learn to Code!

Post image
2 Upvotes

Link to the App Store page: https://apps.apple.com/app/6749594445

Hello everyone, I wanted to share my new Learn to Code app, EasyDev. I built this app using Swift UI in around 4 months, and it is actually my first ever Swift project. I am coming here to gain some eyes on my app, and give me suggestions on what I can do to make my app better and grow as a developer.

The app itself was made exclusively by me, including all the programming, UI, assets, logos, etc. The actual learning content was also handcrafted by using structures similar to popular websites such as Edube and Learncpp, and there is a lot of interactive and descriptive content that takes inspiration from these websites, which are very popular for their effectiveness in teaching people how to code.

If you are interested in learning programming or just want to check the app out, please consider downloading the app using the link above. Also, if you experience any bugs or errors of any kind, please go to the Discord (in the app store page or directly in the app (Settings -> Join the Discord)) and let me know. Thanks in advance!


r/learningpython • • Jun 21 '25

is it even possible to create this

2 Upvotes

i’m looking to build (or at this point even pay) a mini video editing software that can find black screen intervals from my video then automatically overlays random meme images on those black parts, and exports the edited video.


r/learningpython • • May 31 '25

Slowly learning Python - working on the Caesar Cipher exercise.

2 Upvotes

I'm working on the decryption portion of the exercise. It was recommended to use the modulo function to perform the alphabet letter shift.
While I am slowly understanding the modulo shift for encrypting (moving forward in the alphabet) - I'm not understanding how the modulo shift works for decrypting (moving backward in the alphabet):

My specific issue:

Let's say that you're working with the "c" character (index position 2), with the idea of decrypting it, by shifting backwards 5 spaces. you get the "x" character as the decoded letter (index position 23).
How does one divide -3 by 25 to get mod 23?

If someone could explain that, I'd be really grateful.


r/learningpython • • May 20 '25

How do I install Curses for python? (On windows)

2 Upvotes

I saw some files for this, but idk how to use them, please give me a step-by-step tutorial in the comments, I just want to code snake (I already made something like snake, but I need Curses to make it actually snake)


r/learningpython • • May 17 '25

Want to learn more

2 Upvotes

Hi, im a biological engineering undergrad. I had taken an python course in one of my semesters and as a result I have some basic understanding of the concepts. but however I know that I've just scratched the surface and haven't learnt/applied anything in depth.

I want to learn python little bit more application oriented (in the data science and ML side of things) and I genuinely don't know where to start or how to start.

Any help is greatly appreciated, as to how to move forward with projects or roadmaps. I also would like to have good learning materials with which I can strengthen my fundamentals for the same.

Thanks in Advance!!!


r/learningpython • • Apr 25 '25

I finally figured out what I want to do with my life—but I need your help to see if this plan holds up.

2 Upvotes

Hey everyone. I’m finally at the point where I know what I want to do: I want to become a full-stack developer, and I’m going all in. No more second-guessing, no more endless “should I/shouldn’t I”—this is it. I'm fully committed.

That said, I need a sanity check on my approach, especially from those of you who’ve walked this path or are currently deep in it.

Context:

I work full-time (8–5, Monday to Friday), and every 4th day is a 24-hour shift that can bleed over weekends.

I’m making this shift not just for income—it’s a deliberate move because I’m not being valued where I currently work.

There’s some financial pressure from past debt, but it’s not the main driver.

I’d been working through CS50P and making real progress daily—until I hit file I/O and the concepts beyond. That’s when it hit me: I didn’t build enough fundamentals before diving into something so deep.

I’ve decided to start with JavaScript tutorials—not to switch languages, but to better understand core programming logic in a different way.

My main focus is Python, and I want to be job-ready for at least a junior developer role in the next 3–6 months. I’m aiming to hit above-average junior pay—not from entitlement, but by proving my value with strong projects and deep learning.

My current process (recent breakthrough):

Split each tutorial into two sessions to reduce cognitive overload after work.

Follow the JavaScript tutorial step-by-step (e.g. building a calculator).

After each half of the JS tutorial, rebuild that exact part in Python from memory and logic.

If I hit any walls, I save that version into a “struggled-with-this” folder for review.

Between sessions, I reflect on what worked, what didn’t, and how I can improve it next time.

Everything is tracked and organized in Notion to keep momentum and clarity.

Why I’m posting: I think this could be a really strong system—but I don’t know what I don’t know. I’d love your feedback on:

Does this sound like a good way to approach it?

Am I setting myself up for burnout or does the pacing make sense?

Is the JavaScript-to-Python method helping or just a creative detour?

What would you tweak if this were your plan?

Thanks in advance for any thoughts, warnings, or tweaks! I’d really appreciate it.


r/learningpython • • Jan 22 '25

Looking to practice loops

2 Upvotes

Hello,

Do any of you guys know of any platforms where you can practice writing loops with the help an AI instructor? Thank you for your time.


r/learningpython • • Nov 15 '24

Step by step guide to becoming a backend developer in 2024

Thumbnail
roadmap.sh
2 Upvotes

r/learningpython • • Oct 23 '24

Is there a way to find a package name from an imported module's name?

2 Upvotes

Is there some way of intuiting a package's name from the module's name? For instance, in my source file I see import pywt. How do I learn that the package I need to install is PyWavelets? I have pip_search, and PyWavelets is listed when I search for pywt, but so are a dozen other packages.


r/learningpython • • Oct 22 '24

help with python assignment

Post image
2 Upvotes

I’m new to programming and i’ve messaged my teacher (no response) but all assignments require a submission to go to the next. i’m literally so confused and not sure if it’s an issue with my code or the editor (vs code). if someone could help me out i’d greatly appreciate it!

  • The terminal is only showing one line and not the rest. i’ve tried to many different things and asked chatgpt and youtube and nothing has helped..


r/learningpython • • Aug 25 '24

OOP in python

2 Upvotes

I consider myself very new to python and an advanced beginner at coding in general.

I'm taking another try at understanding OOP and this time around, it is making a little more sense which brings me to my question.

Why isn't everyone programming using OOP?


r/learningpython • • Jul 01 '24

Learning python guides but for intermediate people

2 Upvotes

So as the title says, I'm trying to learn python and I understand what I've been learning so far. However, it's all so simplistic and things that I already know for the most part. Can any of you suggest a course through youtube or just a great study guide. I want to get into network auditing and hardening, so its imperative I learn at least one or two languages. Also, what should I learn beyond that code wise? Java seems so daunting


r/learningpython • • Jun 06 '24

Need help on assignment

Post image
2 Upvotes

r/learningpython • • May 22 '24

Why is my "if" statement, the only code being executed, and not my "elif"?

2 Upvotes

(I'm on my pc so hopefully my code translates ok for folks on mobile.)

This is for the CS50 Python class (extensions.py if any one is familiar with this exercise). The object is to input something like: "cat.gif", and it should return, "image/gif". Or, "document.pdf" should return, "application/pdf.

The "if" and "elif" are suppose check the "image" array, and "app" array respectfully. The "if" seems to check the image array just fine. However, no matter what file extension I put, whether an app extension, or something made up, it always just runs the "if" part of the if statement and prints "image/whatEverBs_I_typed". Does any one have any insight as to why the elif statement isn't being executed?

image = ["gif", "jpg", "jpeg", "png"]
app = ["pdf", "txt", "zip"]

fileName = input("File name: ").split(".")

if fileName[1] == image[0] or image[1] or image[2] or image[3]:
    print("image/" + fileName.pop(1))
elif fileName[1] == app[0] or app[1] or app[2]:
    print("application/" + fileName.pop(1))

r/learningpython • • May 14 '24

How do I install different version of Python and different version of Python libraries?

2 Upvotes

I need different a version of Python and Tensorflow for a hand gesture recognizer. How can I install different version of Python and Python libraries. Also does anyone have a working Hand Recognizer that can recognizer different hand gesture from your webcam?


r/learningpython • • May 01 '24

Where does jupyter lab install modules when using pip install

2 Upvotes

I do not want installed modules to be installed on my solid state disk, but on my external hard drive. instead. Is there a way to do this?


r/learningpython • • Mar 20 '24

Getting started with web scraping in Python

2 Upvotes

I've done some basic Python programming, but I'm a bit intimidated by the idea of scraping websites. I've heard it can be a bit tricky to navigate and that there are various considerations to keep in mind. I stumbled upon something called antidetect browsers like GoLogin. Can anyone shed some light on whether they're actually useful for web scraping? I know that they can automate tasks like logging in, navigating through websites, and scraping data.


r/learningpython • • Feb 13 '24

Please help me.

2 Upvotes

I'm coding in Python as a hobby for some years now and I want to code without comments. I'm currently writing the base structure for an AI library and I would like to get feedback how readable/good/bad my code is. The code for controlling the network is here:

from nodes import *


class WrongLayerChosen(Exception):
    pass


class Network:
    def __init__(self, input_nodes: int | list[InputNode], hidden_layers: list[int] | list[list[Node]],
                 output_nodes: int | list[OutputNode]):
        if isinstance(input_nodes, int):
            self._input_layer: list[InputNode] = list(InputNode() for i in range(input_nodes))
        else:
            self._input_layer: list[InputNode] = input_nodes

        if isinstance(hidden_layers[0], int):
            self._hidden_layers: list[list[Node]] = [list(Node(hidden_layers[i - 1]) for j in range(hidden_layers[i]))
                                                     for i in range(1, len(hidden_layers))]
            self._hidden_layers.insert(0, list(Node(input_nodes) for i in range(hidden_layers[0])))
        else:
            self._hidden_layers: list[list[Node]] = hidden_layers

        if isinstance(output_nodes, int):
            self._output_layer: list[OutputNode] = [OutputNode(hidden_layers[-1]) for i in range(output_nodes)]
        else:
            self._output_layer: list[OutputNode] = output_nodes

        self.layer_count = 2 + len(hidden_layers)

    def get_layers(self):
        output_list: list[list[InputNode | Node | OutputNode]] = [self._input_layer]
        for layer in self._hidden_layers:
            output_list.append(layer)
        output_list.append(self._output_layer)
        return output_list

    def get_layer(self, index: int):
        return self.get_layers()[index]

    def get_node(self, layer: int, index: int):
        return self.get_layer(layer)[index]

    def get_weights(self, layer: int, index: int):
        if layer == 0:
            raise WrongLayerChosen
        return self.get_layer(layer)[index].get_weights()

    def set_weights(self, layer: int, index: int, weights: list[float]):
        if layer == 0:
            raise WrongLayerChosen
        elif layer == self.layer_count - 1 or layer == -1:
            self._output_layer[index].set_weights(weights)
        elif layer < 0:
            layer += 1
        self._hidden_layers[layer][index].set_weights(weights)

    def get_weight(self, layer: int, index: int, weight_index: int):
        if layer == 0:
            raise WrongLayerChosen
        return self.get_layer(layer)[index].get_weight(weight_index)

    def set_weight(self, layer: int, index: int, weight_index: int, new_weight: float):
        if layer == 0:
            raise WrongLayerChosen
        elif layer == self.layer_count - 1 or layer == -1:
            self._output_layer[index].set_weight(weight_index, new_weight)
        elif layer < 0:
            layer += 1
        self._hidden_layers[layer][index].set_weight(weight_index, new_weight)

    def get_bias(self, layer: int, index: int):
        if layer == 0:
            raise WrongLayerChosen
        return self.get_layer(layer)[index].get_bias()

    def set_bias(self, layer: int, index: int, new_bias: float):
        if layer == 0:
            raise WrongLayerChosen
        self.get_layer(layer)[index].set_bias(new_bias)

    def get_value(self, layer: int, index: int):
        return self.get_layer(layer)[index].get_value()

    def set_value(self, layer: int, index: int, new_value: float):
        self.get_layer(layer)[index].set_value(new_value)


if __name__ == "__main__":
    network = Network(10, [9, 8, 7], 6)

and the code for the nodes is here:

class InputNode:
    def __init__(self):
        self._value: float = 0

    def set_value(self, value: float):
        self._value = value

    def get_value(self):
        return self._value


class Node(InputNode):
    def __init__(self, node_count_of_layer_before):
        super().__init__()
        self._bias: float = 0
        self._weights: list[float] = [0 for i in range(node_count_of_layer_before)]

    def set_weights(self, weights: list[float]):
        self._weights = weights

    def get_weights(self):
        return self._weights

    def set_weight(self, index: int, value: float):
        self._weights[index] = value

    def get_weight(self, index: int):
        return self._weights[index]

    def set_bias(self, bias: float):
        self._bias = bias

    def get_bias(self):
        return self._bias


class OutputNode(Node):
    def __init__(self, node_count_of_last_hidden_layer):
        super().__init__(node_count_of_last_hidden_layer)

r/learningpython • • Oct 27 '23

Loosing my mind - Advice needed (college)

2 Upvotes

I'm currently enrolled in an introductory Python programming course at university, and I'm struggling so bad right now. While most people I know find this course easy, I'm finding it extremely difficult and often feel lost. I work through the zyBooks assignments each week, taking my time to ensure I grasp the material, yet my classmates who speed through them seem to have a much better understanding of the homework and lab work.

Speaking of the lab, I frequently rely on my lab partners, and since we rotate partners often, it can be somewhat embarrassing to sit quietly, pretending to contemplate the code while I daydream, and they complete the entire assignment. It's not because I want to do this, but I just get confused and give up a couple times before fully checking out. Almost everyone I talk to in this class either took AP Computer Science in high school or just quickly grasps new concepts. The pace of this course is crazy. We're introduced to concepts like nested loops, arrays, etc., and suddenly we're expected to be experts in these functions, knowing how and when to implement them and understanding their impacts on other python functions. I currently have a B but that's only because I've resorted to cheating on homework and relying on others in the lab just to get by.

The most frustrating aspect of all of this is not just how challenging it is for me, but how effortless it appears to be for others. I slacked off throughout high school, and I feel like I haven't developed the skills needed to handle these demanding college courses. It's disheartening, especially because this is just the introductory level. I'm determined not to change my major; I want to graduate with a STEM degree, and the idea of becoming a software engineer and the potential salary are motivating factors. But I genuinely just might be too dumb.

Despite the difficulties, I want to mention that I am learning a lot. It's just that I'm learning at a slower pace and definitely not learning as much compared to others, and my primary concern is how I'll fare in the next course, data structures. I know it's a crucial class, and if I'm struggling now, I fear my chances of success might be slim. I'm seeking your honest opinion, but please, some words of encouragement. I truly need that support right now.


r/learningpython • • Oct 04 '23

Youtube function disappearing when opening document again.

Post image
2 Upvotes

I’m two weeks into learningand making a YouTube downloader. After installing Pytube when I typed YouTube in highlight in Visual Studio code and works.

When I open the code again a day late r YouTube will not be highlighted in the code. When I type YouTube it will not change and highlight an add a function.

When I run the code it says the YouTube function is not defined.

I got stuck for hours and did a fresh Iinstall of windows. Everything worked and then a day later the same issue happened.

I’m completely stuck. I have no idea why Visual code works and then Stops. I’ve deleted all my plugins and extensions and downloaded again. I still can not get YouTube to work in my code.

Any help is appreciated


r/learningpython • • Sep 28 '23

imbalanced dataset

2 Upvotes

Hi,
For a project, I need to create a machine learning program that predicts whether a person is within a certain income bracket. The dataset is pretty large with 159 variables and n = 220000. So now within the dataset, more than 60% consist of zeros which makes the randomForest overfit, and the cross-validation accuracy stays stranded at 80 %. Does anyone have any tips on how to balance the dataset and get a higher cross-validation accuracy?


r/learningpython • • Sep 26 '23

Is there a glossary for this?

2 Upvotes

I was wondering if there is a compiled list of python commands with explanations?


r/learningpython • • Sep 23 '23

Excel to Python Exercises, Calculating Percentages

2 Upvotes

I hope this will be useful to this category. I'm doing some lessons showing people how to do analysis in Python by showing how something in Excel can be done in Python.

One of the ways I learned Python was by taking things I was doing in Excel and trying to do them in Python. In that spirit this lesson we will look at how Excel calculates a percent, and we'll show you how to do that in Python.

https://youtu.be/aw_kEgSWXZE?si=tbpE9L5ASTgmD1AX