Last active
April 19, 2019 10:42
-
-
Save seungwoonlee/2e2636bcb33fc08c0e3431cc81a0eb01 to your computer and use it in GitHub Desktop.
한글이 포함된 날짜 문자열을 정규식만으로 변환
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 # 정규식(Regular Expression) | |
str = '2019-04-19 오후 1:50:39' # 2019-04-19 1:50:39 PM 로 바꾸고 싶다. dateutil.parser.parse()를 사용하기 위해서 | |
newstr = re.sub(r"(\S+) 오후 (\S+)", r"\1 \2 PM", str) # 2019-04-19 1:50:39 PM | |
print(newstr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment