Leetcode 1108. Defanging an IP Address | | Leetcode 1108. Defanging an IP Address 文章作者:Tyan博客:noahsnail.com | CSDN | 简书 1. Description 2. Solution解析:Version 1,遍历替换字符即可。 Version 1 123456789class Solution: def defangIPaddr(self, address: str) -> str: res = '' for ch in address: if ch == '.': res += '[.]' else: res += ch return res Reference https://leetcode.com/problems/defanging-an-ip-address/ 如果有收获,可以请我喝杯咖啡! 赏 微信打赏 支付宝打赏