We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4153da0 commit bcd729fCopy full SHA for bcd729f
_46_demo.py
@@ -1,10 +1,12 @@
1
2
-print('hello '+__name__)
+print('hello from demo'+__name__)
3
4
def main():
5
6
print('hello')
7
print('welcome user')
8
9
if __name__ == '__main__':
10
- main()
+ main() # to prevent call if just imported
11
+
12
+# main()
_46_specialvariable__name__.py
@@ -1,9 +1,12 @@
-import _46_demo
+# print(__name__) # __main__
+# print('hello'+__name__) # hello__main__
-# print(__name__)
-print('hello'+__name__)
+import _46_demo #hello from demo_46_demo
+print('hello from sp'+__name__) # hello from sp__main__
print("its time to calculate")
__pycache__/_46_demo.cpython-312.pyc
410 Bytes
0 commit comments