From 58bc31adee307d73d3eeeb2233467c6d7e1ebb7d Mon Sep 17 00:00:00 2001 From: Marsh232 Date: Wed, 7 Sep 2022 01:08:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D1=8B=20=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D1=83=20=D1=81=D1=82=D1=80=D0=BE=D1=87=D0=B5?= =?UTF-8?q?=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 25 ++++++++++++++++++++++++- main.py | 8 +++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0958b9d..2c01574 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -31,9 +31,31 @@ "node.js.detected.package.eslint": "true", "node.js.detected.package.tslint": "true", "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)" + "node.js.selected.package.tslint": "(autodetect)", + "settings.editor.selected.configurable": "preferences.lookFeel" } }]]> + + + + @@ -44,6 +66,7 @@ 1662478847997 + diff --git a/main.py b/main.py index 5715741..9ad03d5 100644 --- a/main.py +++ b/main.py @@ -2,8 +2,10 @@ import ipaddress ip = input('Введите ip: ') # Пользователь вводит ip -list_ip = ip.split('/') +list_ip = ip.split('/') # Разделяет вводимый ip на часть с маской, и без ipv4 = ipaddress.ip_address(list_ip[0]) -print(ipv4) -net = ipaddress.ip_network('192.168.10.0/24') # В функцию кладётся сетевая часть ip, без хостовой части +print('Ваш ip адрес:', ip) # Выводит например "Ваш ip адрес: 192.168.10.128/24" + +net = ipaddress.ip_network(ip, strict=False) # В функцию кладётся сетевая часть ip, без хостовой части +print(net) print(net.netmask) \ No newline at end of file