Skip to content

Instantly share code, notes, and snippets.

@stilllisisi
Last active February 18, 2020 03:06
Show Gist options
  • Save stilllisisi/f4e20da46825d03d73bd6d023b12ab30 to your computer and use it in GitHub Desktop.
Save stilllisisi/f4e20da46825d03d73bd6d023b12ab30 to your computer and use it in GitHub Desktop.
【python-字符串/正则表达式】正则调整文本格式
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