从一个字符串中减去另一个字符串,得到一个新的字符串结果
host_ip = 'hello world'
host = 'world'
ip = host_ip.replace(host, "")
print(ip)
import re
host_ip = 'hello world'
host = 'world'
ip = re.sub(host, "", host_ip)
print(ip)
host_ip = 'hello world'
host = 'world'
ip = host_ip.translate(str.maketrans("", "", host))
print(ip)