Commit b781dc78 authored by muris2016's avatar muris2016
Browse files

Errores sobre argumentos capturados

parent 003fd023
......@@ -2,19 +2,25 @@
# -*- coding: utf-8 -*-
import sys
import calcoohija
from calc import to_number
import calcoo
import calcoohija
def capture_argv_error():
if len(sys.argv) != 2:
sys.exit("Error: incorrect parameters\nUse: script filename ")
def operating(calc, operation, numbers):
ans = int(numbers[0])
for num in numbers[1:]:
ans = calcoo.do_operation(calc, operation, ans, int(num))
ans = calcoo.do_operation(calc, operation, ans, to_number(num))
print(ans)
if __name__ == "__main__":
script, filename = sys.argv
capture_argv_error()
filename = sys.argv[0]
calc = calcoohija.CalculadoraHija()
file = open(filename)
for line in file.readlines():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment