Livejournal
Log in
Post
Friends
My journal
alexus27
python import re, string
Dec 12, 2017 22:14
Python: given a string, keep only alphanumeric charecters:
https://stackoverflow.com/questions/1276764/stripping-everything-but-alphanumeric-chars-from-a-string-in-python
tl;dr:
re.sub('[\W_]+', '', sourcestring)
is way faster than anything else.
python
Leave a comment
Previous post
Next post
Up