Reading 05: Code
This commit is contained in:
parent
4719d0fa73
commit
241c1e8aec
2 changed files with 26 additions and 0 deletions
15
reading05/exists.py
Executable file
15
reading05/exists.py
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
exit_code = 0
|
||||
|
||||
for filename in sys.argv[1:]:
|
||||
if os.path.exists(filename):
|
||||
print(f"{filename} exists!")
|
||||
else:
|
||||
print(f"{filename} does not exist!")
|
||||
exit_code = 1
|
||||
|
||||
sys.exit(exit_code)
|
||||
Loading…
Reference in a new issue