Question #77

Which value does the Python interpreter assign to __name__ when running the source file directly?

When the Python interpreter runs a file directly, it assigns the value __main__ to the variable __name__ for that source file. If the file is imported from a different file, then the interpreter will assign the variable __name__ of to foo . (

Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵