After breaking a python program into functions, how do I make one the main function? -


This is the biggest newbie question on the planet, but I'm not sure. I have written a group of tasks that work, and I want a "main" function, for example, when I call "someProgram.py", run the function 1, function 2 and leave me " Main ", but I do not have any clue.

Python is not a collection of scripts functions, rather the collection of statements - functions and class definitions are just such statements Which bind the function or class object names.

If you put a print statement in your upper or middle program, it will run normally without any function. This means that you can enter all the main codes at the end of the file and the script will run when running. However, if your script is ever imported instead of directly running it, then it will also run the code. It's not usually what you want so you want to avoid it.

Python transfers a

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -