Is there a way to read the code of modules and functions written by others people? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is there a way to read the code of modules and functions written by others people?

I would like to know if exists a way to read the modules and functions code written by others so to have the possibility to modify it and use what you need in a wide-DRY way.

12th Nov 2019, 8:06 AM
Luca Tartufari
Luca Tartufari - avatar
3 Answers
+ 3
Obviously you can! Most, if not all, of the modules are available on github or may be other similar platforms where you can see and understand, even, can modify and use. Or if you've it already installed, just import the module in the interpreter and look for its location using module_name.__file__ For most of the cases they'll be in a directory named site-packages where you can obviously modify it but be careful 'cause you may break the code and thus may need to remove and reinstall that module but in any case, yes you can modify it and use.
12th Nov 2019, 4:56 PM
Шащи Ранжан
Шащи Ранжан - avatar
+ 2
Luca you're welcome and happy pythoning!
13th Nov 2019, 2:53 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 1
Really? Gorgeous! Thank you very much! So for each function or module i can read the code and modify it using the technic you told me? I'm just new in Python i'm studying the foundamentals but i think this is the top! Python n.1. I hope in the future, when i will have done kore experience with Python to modify everything i need to adapt to my necessity. Thanks with my heart! 😊
12th Nov 2019, 7:36 PM
Luca Tartufari
Luca Tartufari - avatar