Python正则反向引用

str2 ="2018-10-29"
c =re.sub(r"(\d{4})-(\d{2})-(\d{2})","\g<1>/\g<2>/\g<3>",str2)
print(c)
posted @ 2018-10-31 16:02  雷神约  阅读(534)  评论(0编辑  收藏  举报