I was following a tutorial to build a simple port scanner, and the instructor used the following syntax to call a function, but, they didn't really explain the syntax.
Syntax
if __name__ == '__main__':
main()
Questions
- Is this the same as saying, if main() is called somewhere in this script, run main()?
- If the above is true, why wouldn't you just run main() when you needed it elsewhere in the code?
Aucun commentaire:
Enregistrer un commentaire