1 text是xxxx年xx月xx日
re.sub(‘年月‘,‘-‘,text[:-1]).
2
import time def datetrans(text): dates = time.strptime(text, "%Y年%m月%d日") return time.strftime("%Y-%m-%d", dates)
python xxxx年xx月xx日转换成日期 xxxx-xx-xx
原文:https://www.cnblogs.com/jackduan/p/11940506.html