+ 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?

16th Dec 2019, 5:22 PM
Alina Sansevich
Alina Sansevich - avatar
8 Antworten
+ 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 😁
16th Dec 2019, 6:37 PM
Alina Sansevich
Alina Sansevich - avatar
+ 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
16th Dec 2019, 5:44 PM
Nihilo
Nihilo - avatar
+ 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 👍
16th Dec 2019, 6:33 PM
Alina Sansevich
Alina Sansevich - avatar
+ 3
Thank you DevilLettuce for the link, I'll check it out! 😃👍
16th Dec 2019, 6:34 PM
Alina Sansevich
Alina Sansevich - avatar
+ 3
Thank you Coding Einstein, you are right, I always forget about help() 🤦‍♀️
20th Dec 2019, 4:00 AM
Alina Sansevich
Alina Sansevich - avatar
+ 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.
16th Dec 2019, 5:43 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 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!
16th Dec 2019, 5:49 PM
Gonçalo Magalhaes
Gonçalo Magalhaes - avatar
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
20th Dec 2019, 2:36 AM
Dace [Super Inactive| Challenge=Maybe]
Dace [Super Inactive| Challenge=Maybe] - avatar