def main(): Question

Asked 2 years ago, Updated 2 years ago, 20 views

if name=="main":

Python is an interpreter's language, so I understand that you use the sentence above to start with the part you want Does def main(): play the same role?

python

2022-09-22 19:49

1 Answers

You can think of it as a rule, not as an interpreter language.

If the entry function in C language was run(), you would have asked if def run(): does this work?(The compiled binary code (machine language) does not contain the function name main.)

That is, in Python, the main() is a function without anything unusual.


2022-09-22 19:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.