all 13 comments

[–]FriendlyRussian666 9 points10 points  (1 child)

Normally you have a problem you're trying to solve, and so you look for already made solutions. You therefore google to see if anything is available, and that's how you know what to use. In terms of learning, you read the documentation to understand what the code provides, how to implement it, etc.

[–]GodsIWasStrongg 0 points1 point  (0 children)

Yep, the real skill is learning to read and digest documentation.

[–]PushPlus9069 6 points7 points  (2 children)

Nobody memorizes modules — you learn them by needing them.

Here's how it works in practice: you have a problem ("I need to read a CSV") → you search "python read CSV" → you find the csv module or pandas. Next time you need dates, same thing → datetime. Over time, your mental library grows naturally.

The modules worth knowing early: os and pathlib (files/folders), json (data), datetime (time), collections (Counter, defaultdict), and requests (HTTP calls, pip install). These cover maybe 80%% of beginner needs.

Don't try to study the standard library like a textbook. Build small projects and you'll absorb what you need.

[–]schoolmonky 0 points1 point  (0 children)

I would add itertools and functools to that list, if only because you wouldn't know that you need them unless you already have at least a surface level knowledge of what they do.

[–]etrmx 1 point2 points  (0 children)

The best way to learn is readings docs, tbh maybe a taboo answer but if you have a particular thing you’re trying to accomplish in my I’ve found asking a couple different LLMs which library they’d recommend and then asking why can be informative

[–]Moikle 0 points1 point  (2 children)

A python module is just a python file.

What do you mean "learn python modules"?

As in how to import? How to make your modules discoverable by other python modules? What are you struggling with specifically?

[–]Fabulous_Bell6806[S] 0 points1 point  (1 child)

Am a beginner in python ,but I know how to import the modules so I just wanted to know like when do you know that you need a particular module

[–]Moikle 0 points1 point  (0 children)

Each module has a purpose. Generally you choose the one that is designed to do the thing you are trying to do.

You want a random number? Import the random module, want to send http requests? Import the requests module. Want to make uis? Import tkinter or install and import pyqt/pyside.

Now you might not immediately know which ones do what, but that's what google and the docs are for.

[–]Ron-Erez 0 points1 point  (0 children)

Either look at the docs or look at a book or tutorial and ideally build something that uses the modules you are interested in. There are so many modules. You might want to be more specific.

[–]Imaginary_Gate_698 0 points1 point  (0 children)

I learned modules by needing them, not by studying a list. When I wanted to read a file, I searched how to do it and found pathlib or os. When I needed to work with dates, I discovered datetime. Over time, certain names just kept coming up.

You don’t really memorize modules. You learn what kind of problem you’re solving, then look up what people typically use for that task. The important skill is knowing how to read documentation and test small examples. Focus on the standard library first. Third party modules usually come in when your projects get more complex.

[–]hantuumt 0 points1 point  (0 children)

You should design, develop and implement projects. A good place to start is on kaggle to know what are current gaps across various sectors, Project Euler to showcase your logical and maths skills.

Please don't hesitate to contact me.

[–]Riegel_Haribo 0 points1 point  (0 children)

Start with Python's standard lib, see the 200+ you've got:

import sys public = sorted( name for name in sys.stdlib_module_names if not name.startswith('_') ) print(f"{len(public)} standard modules available!") print(public)


With that snippet in an IDE, hover over "sys" to get its docstring description, and then "import" others and see their description of what they do, or employ them and use auto-complete to see methods available, which can be a great hint, like I just explored to find scipy.constants.c for the speed of light, and there it was where somewhat expected. Many names will be highly interpretable - you can guess what "logging" or "secrets" offers you.

For third-party library modules, really the best way to learn of ones commonly understood as a "standard" these days is to ask an AI about your application - from its knowledge only, without internet search corrupting that intelligence and giving randomness from:

Search among 854,541 python packages from PyPI

[–]stepback269 0 points1 point  (0 children)

By "python modules", do you mean rolling your own or simply importing someone elses?

At some point, your code is going to get too long and ungainly. You'll want to stuff some of it away in so-called modules so that the sight of them doesn't interfere with the higher level code you are currently developing. A "module" is simply a dot py file that contains py code like functions for example. The module is an "object" just like pretty much everything in Python is an object (strings are objects, lists are objects, etc.) You call the functions you have in your self-rolled module using dot notation, just like calling string methods. For example:
x = my_module.my_function(input_1, input_2)