Last active
February 18, 2020 03:06
-
-
Save stilllisisi/f4e20da46825d03d73bd6d023b12ab30 to your computer and use it in GitHub Desktop.
【python-字符串/正则表达式】正则调整文本格式
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
s = "1991-02-28" | |
re.sub(r"(\d{4})-(\d{2})-(\d{2})", r'\1/\2/\3') | |
Out[6]: '1991/02/28' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment