+ 4
What's a good approach to learn to use Python libraries?
I'm reading this: https://docs.python.org/3/library/os.html I'm getting lost to be honest. I am building a simple program with a command line interface and the tutorial I'm following to build the parser uses os and sys modules, so I started reading about those too because I don't want to write lines that I don't understand, but it's counterproductive... Should I just copy those lines and hope to learn this later? What's an efficient way to approach Python libraries when EVERYTHING is new?
8 Answers
+ 5
Thank you Gonçalo Magalhaes , I have read very good reviews about that book but wasn't sure about buying it, I'll take another look now
And yes, Real Python has great tutorials, I'm following one of their articles on argparse for this đ
+ 4
When you start reading the documentation it all feels a bit daunting, that's normal.
You can start by watching a good video on youtube about the library and then you'll start understanding the documentation.
I personally suggest you watch Corey Schafer videos, he's a phenomal tutor on python topics because he explains everything in a very clear and detailed manner
https://youtu.be/tJxcKyFMTGo
+ 3
Thank you Aymane Boukrouh [Unavailable] , I agree with you that copy-paste is not the way, I'll keep in mind the 20-30% you mentioned, some libraries have so much in them that I don't know where to begin, I'll keep asking and googling đ
+ 3
Thank you DevilLettuce for the link, I'll check it out! đđ
+ 3
Thank you Coding Einstein, you are right, I always forget about help() đ€Šââïž
+ 2
I don't think there is a best approach, so this is just my personal preference.
One thing you should note is that you should NEVER just start learning every single function and method there is in a library, because in most cases you'll only be using 20% or 30% of it, and probably even less. Learn to read the docs, and to search on google, you will always find an answer. And no, copy-paste is a bad practice. Read the code, try to understand it, then you are free to copy paste and tweak it to your needs, that how programming works anyway.
+ 2
If you're talking about Python Standard Library, I'd recommend Fluent Python book. It will teach you all the secrets of Python's built-in tools and packages.
For other external packages, go with Real Python tutorials.
Happy coding!
0
Alina Sansevich if you want to know more about a module or an attribute of a module, go to the interpreter in your compiler(Pydroid 3) and type help()
then type the module you are not clear on. For example
help()
os.fork
>>os.fork is blah blah como esta