This is my 18th python tutorial for beginners -
python _name_ == '__main__' ||Python Tutorial #18 || Python Tutorial for Beginners
'__main__' is the name of the scope in which top-level code executes. A module’s _name_ is set equal to '__main__' when read from standard input, a script, or from an interactive prompt.
A module can discover whether or not it is running in the main scope by checking its own __name__, which allows a common idiom for conditionally executing code in a module when it is run as a script or with python -m but not when it is imported:
if _name_ == "__main__":
execute only if run as a script
main()
For a package, the same effect can be achieved by including a __main__.py module, the contents of which will be executed when the module is run with -m.
Links :
For python os.walk. Please check • python os.walk|os.system in python ||...
pass argument in python : • pass argument in python|pass paramete...
For reading and writing files : • Reading and Writing into File in pyth...
Be sure to SUBSCRIBE HERE: / @code4you753
You may follow me on facebook : / python-tutorial-for-beginners-141028486539665
For more information. You may visit https://docs.python.org/2/tutorial/da...
This module provides a portable way of using operating system dependent functionality.
===Code===
def main():
print "You are directly running file01"
def anoter_method():
print "You are running indirectly "
if _name_ == '__main__':
main()
else:
anoter_method()
_name_ in python
_main_ in python
python tutorial for beginners
Learn Python Programming
python programming
python tutorial for beginners with examples
python tutorial for beginners video
python scripting tutorial
learning python programming
python install ubuntu python install
python install tutorial
python installation in windows
Tutorial python
Tutorial series
Learning Tutorial
language model python
Tutorial python
Tutorial series
Learning Tutorial
language model python
In this course of my tutorial . I will tell you :
How to use Python programming?
How to get experience in Python programming ?
What is Python ?
How to learn Python ?
We recommend:
Learning Python, 5th Edition by Mark Lutz http://a.co/hJzjfuh
Shop Amazon Used Textbooks - Save up to 90% http://amzn.to/2pllk4B
To know about youtube : https://en.wikipedia.org/wiki/YouTube
Later sections : We will learn oracle database and how to connect database :
http://www.oracle.com/technetwork/art...
python kivy
desktop application
mobile apps
python project