File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ # message.py is a module (imported inside module.py)
2+ # so execute python3 module.py
3+ # Start typing below commands and see the output
4+
5+ def hello (name ):
6+ print ('Hello ' + name )
7+
8+ def welcome (name ):
9+ print ('Welcome ' + name )
Original file line number Diff line number Diff line change 1+ # Open terminal >
2+ # python3 module.py
3+ # python3 module.py <String>
4+ # Start typing below commands and see the output
5+
6+ # Import module
7+ from message import hello , welcome
8+ # from message import *
9+ # import message # then use as message.hello
10+
11+ print (hello ('Ashwin' ))
12+ print (welcome ('Ashwin' ))
13+
14+ if __name__ == '__main__' :
15+ import sys
16+ if len (sys .argv ) > 1 :
17+ hello (sys .argv [1 ])
18+ else :
19+ hello ('Unknown' )
You can’t perform that action at this time.
0 commit comments