ommit os library

This commit is contained in:
Simon Gonçalves Costa 2026-03-27 20:47:16 -03:00
parent 548ea411b9
commit 8babc75ad0
4 changed files with 34 additions and 0 deletions

Binary file not shown.

18
modulo_os/ping.py Normal file
View File

@ -0,0 +1,18 @@
import os
import utilities
import sys
endereco = input("Digite um endereço IP: ")
if not utilities.validar_ip(endereco):
print ("O endereço IP é inválido.")
sys.exit(0)
comando = f"ping {endereco}"
resultado = os.system(comando)
if not resultado:
print("O endereço existe")
else:
print("O endereço não existe")

8
modulo_os/testes.py Normal file
View File

@ -0,0 +1,8 @@
import os
print (os.name)
print (os. getcwd())
print(os.environ)
print(os.path)

8
modulo_os/utilities.py Normal file
View File

@ -0,0 +1,8 @@
def validar_ip (ip : str) -> bool:
octetos = ip.split(".")
if len(octetos) != 4:
return False
for octeto in octetos :
if int (octeto) <0 or int(octeto) > 255:
return False
return True