Skip to content

Instantly share code, notes, and snippets.

@han8909227
Created October 20, 2017 18:39
Show Gist options
  • Save han8909227/eeb8b5a1e154317340c82abc5becff60 to your computer and use it in GitHub Desktop.
Save han8909227/eeb8b5a1e154317340c82abc5becff60 to your computer and use it in GitHub Desktop.
week1_GITS
def query_to_dic(query):
no_char = query.translate({ord(c): " " for c in "!@#$%^&*()[]{};:,./<>?\|`~-=_+"})
no_char_list = no_char.split()
return dict(no_char_list[i:i + 2] for i in range(0, len(no_char_list), 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment