What is the most elegant way to reverse the process of Python's str.format on replacing arguments by position?
For example for the following
textpattern = 'Please move {0} to {1}'
mystring = 'Please move a to b'
a deformat
function :
mystring.deformat(textpattern)
will return the list ['a', 'b']
. The variable textpattern
is being entered by the user and then dynamically fetched from the DB.
The closest thing I found is a question about scnaf in Python but that's slightly different.