Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d085cf5

Browse files
fix example
Signed-off-by: Nikhil Dhandre <nik.digitronik@live.com> --amend Signed-off-by: Nikhil Dhandre <nik.digitronik@live.com>
1 parent ac11513 commit d085cf5

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎file_and_modules.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,8 @@ Executing the else clause.
8989
## Writting a simple CIL script
9090
* We write scripts in order to reuse it multiple times.
9191
* In python you see '__' double underscore aka dunder.
92-
* Create a script greetings.py
92+
* Create a script greetings.py and fun.py
9393
```
94-
[raukadah@ironman python-workshop]$ python3 fun.py
95-
Welcome FOSS MEET
96-
the value of __name__ is greetings
9794
[raukadah@ironman python-workshop]$ cat greetings.py
9895
#!/usr/bin/python3
9996
import sys
@@ -105,14 +102,21 @@ def greeting(name):
105102
if __name__ == "__main__":
106103
name = "Chandan Kumar"
107104
greeting(name)
105+
106+
[raukadah@ironman python-workshop]$ python3 greeting.py
107+
Welcome Chandan Kumar
108+
the value of __name__ is __main__
109+
```
110+
```
108111
[raukadah@ironman python-workshop]$ cat fun.py
109112
#!/usr/bin/python3
110113
111114
import greetings
112115
113116
greetings.greeting('FOSS MEET')
117+
114118
[raukadah@ironman python-workshop]$ python3 fun.py
115119
Welcome FOSS MEET
116120
the value of __name__ is greetings
117-
[raukadah@ironman python-workshop]$
118-
```
121+
```
122+
* Observe meaning of `__name__` and `__main__`.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /