summaryrefslogtreecommitdiff
path: root/py03/ex0/ft_command_quest.py
diff options
context:
space:
mode:
authoryctct <yctct@yctct.com>2026-06-07 08:59:04 +0200
committeryctct <yctct@yctct.com>2026-06-07 08:59:04 +0200
commit15115b4c52bfda0d1cca9fa1155beecbb873ec35 (patch)
treeb3f0975e63eb04dcba732a78ce9bd9abda8acf01 /py03/ex0/ft_command_quest.py
First commit, add all files
Diffstat (limited to 'py03/ex0/ft_command_quest.py')
-rwxr-xr-xpy03/ex0/ft_command_quest.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/py03/ex0/ft_command_quest.py b/py03/ex0/ft_command_quest.py
new file mode 100755
index 0000000..af568f5
--- /dev/null
+++ b/py03/ex0/ft_command_quest.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+# print(str(sys.argv))
+
+import sys
+
+
+def print_argv():
+ print(f"Program name: {sys.argv[0]}")
+ if not sys.argv[1:]:
+ print("No argument provided!")
+ else:
+ arg_received = len(sys.argv) - 1
+ print(f"Arguments received: {arg_received}")
+ index = 1
+ for arg in sys.argv[1:]:
+ print(f"Argument {index}: {arg}")
+ index += 1
+ print(f"Total arguments: {len(sys.argv)}")
+
+
+if __name__ == "__main__":
+ print("=== Command Quest ===")
+ print_argv()