Q.2 I couldn't get line 3. module name is available as global var but from where we are accessing this ?in same/different file ? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Q.2 I couldn't get line 3. module name is available as global var but from where we are accessing this ?in same/different file ?

A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended. Within a module, the module’s name (as a string) is available as the value of the global variable __name__.

4th Jun 2021, 4:17 PM
lisa
1 ответ
0
from inside the module file source, there's a global variable named __name__ wich contains the string name of the file... as in running script (executed by user), global __name__ == "__main__" try this: https://code.sololearn.com/csQNk4kuLSkD/?ref=app
4th Jun 2021, 6:15 PM
visph
visph - avatar