Created
April 10, 2018 09:55
-
-
Save lig/fd608ec8d5cbac8d5ddf04efa51a7411 to your computer and use it in GitHub Desktop.
Nasty f-string hacks
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
In [1]: foo = {} | |
In [2]: f'r u a hacker or wat? {foo.update(a=1)} {locals().update(b="ham")}' | |
Out[2]: 'r u a hacker or wat? None None' | |
In [3]: foo | |
Out[3]: {'a': 1} | |
In [4]: b | |
Out[4]: 'ham' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment