Skip to content

Instantly share code, notes, and snippets.

@jaimevalero
Created August 23, 2020 10:21
Show Gist options
  • Save jaimevalero/5a97c93852286c72af158ad396d14960 to your computer and use it in GitHub Desktop.
Save jaimevalero/5a97c93852286c72af158ad396d14960 to your computer and use it in GitHub Desktop.
Extract user variables in a python session
>>> a=1
>>> b=2
>>> c=3
>>>
>>> # We will extract user variables, filtering those who do not contain '__'
>>>
>>> { k:v for k,v in locals().items() if '__' not in k }
{'a': 1, 'b': 2, 'c': 3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment