Heitor's log


The python way of formatting strings is very interesting. You just need a string with {} and then tell python to change that to something. For example:

>>> '{}'.format(3)

And you can also format that to a string:

>>> '{}'.format('$£@æȩ')

The next obvious step is to format a string to itself:

>>> '{}'.format('{}')

Note that the result is a string:

>>> type('{}'.format('{}'))
<class 'str'>

And we can evaluate that string to turn it into a code:

>>> eval('{}'.format('{}'))
>>> type(eval('{}'.format('{}')))
<class 'dict'>

Now, some ultra advanced python code to rule them all:

>>> str(eval(eval('{}'.format('{}'.format('{}'.format('{}.format({})').format('{}', {}))).format('"{}"', {})).format('{}'.format('{}'))))