Created
June 16, 2020 13:24
-
-
Save daejinseok/dbba586821d5ea9dba68267f8b503c98 to your computer and use it in GitHub Desktop.
python 정규식 split, sub
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
a = "daejin dae aaa" | |
import re | |
re.split(' +', a) | |
['daejin', 'dae', 'aaa'] | |
b = "daejin aaa # daejidna;kdj" | |
re.sub('#.*$', '', b) | |
'daejin aaa ' | |
b = "daejin aaa" | |
re.sub('#.*$', '', b) | |
'daejin aaa' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment