File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -17,20 +17,22 @@ def createparser():
1717 parser = argparse .ArgumentParser (prog = 'pycalc' , description = 'pure Python command line calculator' ,
1818 epilog = """Anton Charnichenka for EPAM: Introduction to Python
1919 and Golang programming, 2018.""" )
20- parser .add_argument ('expression' , nargs = argparse . REMAINDER , help = """mathematical expression string to evaluate;
20+ parser .add_argument ('expression' , help = """mathematical expression string to evaluate;
2121 implicit multiplication is supported""" )
2222
2323 return parser
2424
2525def main ():
2626 """calculation chain"""
2727 parser = createparser ()
28- main_input , spare_input = parser .parse_known_args (sys .argv [1 :])
28+ namespace = parser .parse_args (sys .argv [1 :])
29+ user_expr = namespace .expression
30+ #main_input, spare_input = parser.parse_known_args(sys.argv[1:])
2931 # get user's expression
30- if main_input .expression :
31- user_expr = main_input .expression [0 ]
32- else :
33- user_expr = spare_input [0 ]
32+ # if main_input.expression:
33+ # user_expr = main_input.expression[0]
34+ # else:
35+ # user_expr = spare_input[0]
3436
3537 # calculation chain
3638 # tokenize user's expression string
You can’t perform that action at this time.
0 commit comments