sscanf ?

Erik Max Francis max at alcyone.com
Tue Nov 20 13:29:16 EST 2001


Bruce Edge wrote:

> 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 ) = ?

	x, y = map(int, str.split('.'))

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Laws are silent in time of war.
\__/ Cicero
    Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
 An Esperanto reference for English speakers.



More information about the Python-list mailing list