+ 1
Which lines are executed when a Python file is run?
1 ответ
+ 3
Well, the entire contents of the file are read and processed by the interpreter. What gets executed is a bit more up to you.
You can have python run like a script, and it will execute commands in the order they are written in, or if you use the if __name__ == "__main__": set up, you can have a more procedural or object oriented structure to the program's flow.
It's a very flexible language, so much of the trick is deciding what you want, rather than worrying about being constrained by the language.