FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-packaging-example/printer/printer.py at master · tedops/python-packaging-example · GitHub
tedops
python-packaging-example
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-packaging-example
/
printer
/
printer.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (19 loc) · 595 Bytes
Breadcrumbs
python-packaging-example
/
printer
/
printer.py
Copy path
File metadata and controls
27 lines (19 loc) · 595 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import
argparse
class
WordPrinter
(
object
):
def
__init__
(
self
,
args
):
self
.
args
=
args
def
ensure_necessary_args_exist
(
self
):
if
self
.
args
.
word
:
return
True
return
False
def
run
(
self
):
if
self
.
ensure_necessary_args_exist
():
print
(
"The word you entered is: {0}"
.
format
(
self
.
args
.
word
))
else
:
print
(
"No word entered"
)
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-w"
,
"--word"
,
help
=
"Word to print"
)
args
=
parser
.
parse_args
()
wp
=
WordPrinter
(
args
)
wp
.
run
()
Back
|
FazBrowse Home
|
New Git URL