On Thu, Sep 17, 2020 at 11:09:35PM +1000, Chris Angelico wrote:
I've frequently yearned for an sscanf-like feature in Python. Usually I end up longhanding it with string methods, or else reaching for a regex, but neither of those is quite what I want. I'd prefer scanf notation to format strings, but either is acceptable.
Why make this a syntactic feature when a scanf function would do? This is an often-desired feature: https://duckduckgo.com/?q=python+scanf and for a while there was even documentation on how to simulate it: https://docs.python.org/2.5/lib/node49.html and there are plenty of versions on the web, e.g.: https://code.activestate.com/recipes/502213-simple-scanf-implementation/ Perhaps someone who cares for this more than I do could do the research to find the best implementation and write a PEP. -- Steve