Given a valid (IPv4) IP address, return a defanged version of that IP address.

A defanged IP address replaces every period "."with "[.]".

class Solution:
    def defangIPaddr(self, address: str) -> str:
        return address.replace('.','[.]')


↙↙↙阅读原文可查看相关链接,并与作者交流