where does the python start the code execution from? -
i trying understand when execute .py file, part of code python start execution from? e.g.when execute java program, "public static void main(string[] args)" location java start code execution. so, when talk python, how work? know there python main function
(__name__ = "__main__")
, have gone through article in , out of stackoverflow, loads python module, , python udfs etc. so, per understanding, location executed first thing. please correct me, or guide me web links query.
if python code in method, no code executed unless explicitly call method (e.g. after checking __name__ == '__main__'
). convention call main
method, can call method starting point of execution.
if python code not in method, code executed anytime run or import file.
wiki
Comments
Post a Comment