+ 1
can i prescind from a main in Python?
5 Respostas
+ 7
It is not necessary to use a main function in python, but I always like to use if __name__="__main__"
In my opinion, this is better because you don't have to worry about the order you defined functions/classes in.
It is just a matter of preference in python, I think.
+ 4
Pamela Horn you can use:
def main():
#some code
if __main__=="__name__":
main()
+ 4
Pamela Horn no problem!
+ 1
thank you! do i have to establish one at the end of the classes? Or where do i put it?
+ 1
Aymane Boukrouh thank you so much!