Parse C-style format strings in python

91 Views Asked by At

Let's say a format string is given as export_%05u.png, we can create a full string in python by supplying an integer like this s = "export_%05u.png"%1. But If we have the format string and actual string, is it possible to extract the integer somehow?

Formally, these are given: export_%05u.png and export_00111.png and we need to extract 111.

0

There are 0 best solutions below