From daee3368bcb7b5f524d68e0864e0ee3688ca538a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Zar=C4=99ba?= Date: Tue, 4 Apr 2023 20:14:35 +0200 Subject: [PATCH] sgd --- count_lines.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 count_lines.py diff --git a/count_lines.py b/count_lines.py new file mode 100644 index 0000000..0a2d2fe --- /dev/null +++ b/count_lines.py @@ -0,0 +1,15 @@ +import argparse + +def count_lines(input_file): + with open(input_file) as file: + num_lines = sum(1 for line in file) + return num_lines + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Number of lines') + parser.add_argument('--input_file', type=str, help='file path') + + args = parser.parse_args() + + num_lines = count_lines(args.input_file) + print(f'Number of lines: {num_lines}') \ No newline at end of file