Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ch2] re.split() #1

Open
heejour opened this issue Jul 3, 2019 · 3 comments
Open

[Ch2] re.split() #1

heejour opened this issue Jul 3, 2019 · 3 comments

Comments

@heejour
Copy link
Collaborator

heejour commented Jul 3, 2019

Let's figure out the right way. :)

@kgeneral
Copy link

kgeneral commented Jul 9, 2019

요렇게 하세요~

import re

txt = 'I was a car and you drived that car.'
txt = txt.lower()
words2 = re.split('\s+', txt)
words2

@kgeneral
Copy link

kgeneral commented Jul 9, 2019

\s+ : one or more spaces
\s* (zero or more) 쓰면 empty delimiter warning 나네요.

@kgeneral
Copy link

kgeneral commented Jul 9, 2019

\w 는 alphanumeric + underscore 전부네요.
\w = [a-zA-Z0-9_]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants