Skip to content

Instantly share code, notes, and snippets.

@daejinseok
Created June 16, 2020 13:24
Show Gist options
  • Save daejinseok/dbba586821d5ea9dba68267f8b503c98 to your computer and use it in GitHub Desktop.
Save daejinseok/dbba586821d5ea9dba68267f8b503c98 to your computer and use it in GitHub Desktop.
python 정규식 split, sub
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