+ 1

Doubt in python

Can you please explain why do we use if __name__ == '__main__': in getting datetime in python?

28th Jun 2018, 12:37 PM
Sahil Danayak
Sahil Danayak - avatar
3 Réponses
+ 1
That isn't necessary when using datetime! Although what it does is prevent code from accidentally running when it is not run via the Python interpreter
28th Jun 2018, 1:00 PM
apex137
apex137 - avatar
28th Jun 2018, 1:53 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
Thanks a lot to everyone
29th Jun 2018, 12:17 PM
Sahil Danayak
Sahil Danayak - avatar