Created
January 9, 2017 19:47
-
-
Save pbexe/b8c2d551a69cd816c2d17e43afe01647 to your computer and use it in GitHub Desktop.
Dynamically create variable names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_vars = 'these are some test variable names'.split(' ') | |
for index, var in enumerate(_vars): | |
s = var + ' = '+str(index) | |
exec(s) | |
print(these, are, some, test, variable, names) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment