Skip to content

fix example #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions file_and_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,8 @@ Executing the else clause.
## Writting a simple CIL script
* We write scripts in order to reuse it multiple times.
* In python you see '__' double underscore aka dunder.
* Create a script greetings.py
* Create a script greetings.py and fun.py
```
[raukadah@ironman python-workshop]$ python3 fun.py
Welcome FOSS MEET
the value of __name__ is greetings
[raukadah@ironman python-workshop]$ cat greetings.py
#!/usr/bin/python3
import sys
Expand All @@ -105,14 +102,21 @@ def greeting(name):
if __name__ == "__main__":
name = "Chandan Kumar"
greeting(name)

[raukadah@ironman python-workshop]$ python3 greeting.py
Welcome Chandan Kumar
the value of __name__ is __main__
```
```
[raukadah@ironman python-workshop]$ cat fun.py
#!/usr/bin/python3

import greetings

greetings.greeting('FOSS MEET')

[raukadah@ironman python-workshop]$ python3 fun.py
Welcome FOSS MEET
the value of __name__ is greetings
[raukadah@ironman python-workshop]$
```
```
* Observe meaning of `__name__` and `__main__`.