GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.tutorialsteacher.com — Python Module Attributes: name, doc, file, dict Python Module Attributes: name, doc, file, dictPython module has its attributes that describes it. Attributes perform some tasks or contain some information about the module. Some of the important attributes are explained below: __name__ AttributeThe In the same way, it gives the name of your custom module e.g. calc module will return 'calc'. Example: __name__ Attribute However, this can be modified by assigning different strings to this attribute. Change Example: Set __name__ And check the The value of the When we run any Python script (i.e. a module), its Example: welcome.py Run the above welcome.py in IDLE by pressing F5. You will see the following result. Output in IDLE: __name__ = __main__ However, when this module is imported, its Example: test.py Now run the test.py in IDLE by pressing F5. The Example: test.py This attribute allows a Python script to be used as an executable or as a module. Visit __main__ in Python for more information. __doc__ AttributeThe __doc__ attribute denotes the documentation string (docstring) line written in a module code. Consider the the following script is saved as greet.py The __file__ Attribute
__dict__ AttributeThe The You can use the ![]() Learn more about module attributes in Python Docs. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |