FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SimplePyScripts/HelloPython/HelloPython.py at master · gil9red/SimplePyScripts · GitHub
gil9red
/
SimplePyScripts
Public
Notifications
You must be signed in to change notification settings
Fork
42
Star
153
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
SimplePyScripts
/
HelloPython
/
HelloPython.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (27 loc) · 1006 Bytes
Breadcrumbs
SimplePyScripts
/
HelloPython
/
HelloPython.py
Copy path
File metadata and controls
40 lines (27 loc) · 1006 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
28
29
30
31
32
33
34
35
36
37
38
39
40
__author__
=
"ipetrash"
import
argparse
from
datetime
import
datetime
,
time
def
main
(
namespace
)
->
None
:
args
=
namespace
.
parse_args
()
args
.
user
=
"Илья"
if
args
.
user
:
welcome
=
"Привет"
current
=
datetime
.
now
().
time
()
if
time
(
6
)
<=
current
<
time
(
12
):
welcome
=
"Доброе утро"
elif
time
(
12
)
<=
current
<
time
(
18
):
welcome
=
"Добрый день"
elif
time
(
18
)
<=
current
<
time
(
23
,
59
,
59
):
welcome
=
"Добрый вечер"
elif
time
(
0
)
<=
current
<
time
(
6
):
welcome
=
"Доброй ночи"
print
(
f"
{
welcome
}
,
{
args
.
user
}
!"
)
else
:
print
(
"Привет, Python!"
)
def
create_parser
()
->
argparse
.
ArgumentParser
:
parser
=
argparse
.
ArgumentParser
(
description
=
"Hello World Example!"
)
parser
.
add_argument
(
"--user"
,
type
=
str
,
help
=
" user name."
)
return
parser
if
__name__
==
"__main__"
:
parser
=
create_parser
()
main
(
parser
)
Back
|
FazBrowse Home
|
New Git URL