03
- Python
- the
__main__
function is used so that when you import the script as a module it will not execute the code within it, rather it will now let you import the code as a module so I can from <module> import <something>
The only time the that __name__ == __main__
is when we run the file as a script
- Python 5 Things You're Doing Wrong When Programming in Python
my_tuple = (1,2,3)
x, _, z = my_tuple
import xml.etree.ElementTree as ET
from inspect import getmembers, isclass, isfunction
for (name, member) in getmembers(ET, isclass):
if not name.startswith("_"):
print( name)