sscanf ?

Bruce Edge bedge at
Tue Nov 20 18:17:21 CET 2001

Is there an equivalent function in python?
I know about all the regex stuff, but I have the format string that was
used to generate a string, which I'd like to use to decompose it back
into it's source data:

fmtstr = "%02d.%02d"

str = fmtstr % ( x, y )

# Now get x any y back using only str and fmtstr:

(x, y ) = ?

I suppose I could write something to convert printf style format strings
into regexp format, but it seems like there's gotta be an easier way.

TIA, Bruce.

More information about the Python-list mailing list