str2 ="2018-10-29"
c =re.sub(r"(\d{4})-(\d{2})-(\d{2})","\g<1>/\g<2>/\g<3>",str2)
print(c)

相关文章: