Skip to content

Instantly share code, notes, and snippets.

@hieast
Created May 8, 2019 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hieast/1fc9e5dad298a62178236c0c7bf9f035 to your computer and use it in GitHub Desktop.
Save hieast/1fc9e5dad298a62178236c0c7bf9f035 to your computer and use it in GitHub Desktop.
自己看结果
import re
origin = "abcdefghigkqpwueriwutghlskajdf,mnbz,xcnvoiequynf12341234321065498+7mnbz,xcnvoiequynf12341234321065498+7mnbz,xcnvoiequynf12341234321065498+7mnbz,xcnvoiequynf12341234321065498+7"
meta = "mn"
pattern = re.compile("mn")
assert origin.replace(meta, "") == pattern.sub("", origin)
%timeit(origin.replace(meta, ""))
%timeit(pattern.sub("", origin))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment