JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
3 months ago0 views
👨‍💻Programming
import ipaddress


def ip_do_binarego(ip_str):

    parts = ip_str.split(".")
    return [format(int(part), '08b') for part in parts]


def glowny():
    try:

        ip = input("Podaj adres IPv4: ").strip()


        ipaddress.IPv4Address(ip)


        binarny = ip_do_binarego(ip)
        binarny_ip = ".".join(binarny)

        print(f"Adres IP w postaci binarnej: {binarny_ip}")





    except ValueError:
        print("Błąd: Podano niepoprawny adres IPv4.")


if __name__ == "__main__":
    glowny()
← Back to timeline