python中有没有可以实现如下输入输出的字符串操作?如果我要使用正则表达式,正则表达式将如何替换子字符串?
#inputs
y = sentence-with-dashes
x = this is a sentence with dashes
#output
z = this is a sentence-with-dashes
#####################################
#sometimes the input is pretty messed up like this
y = sentence-with-dashes
x = this is a sentence-with dashes
#output
z = this is a sentence-with-dashes