Module Expr Str Import alias Import alias ImportFrom alias identifier ImportFrom alias identifier Assign NameStore ListLoad Str Str Str Assign NameStore Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Str Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Pass decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Return Call AttributeLoad NameLoad attr Lambda arguments args NameParam defaults CompareIn NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Assign NameStore ListLoad Assign NameStore Num While NameLoad body If BoolOpAnd CompareNotEq NameLoad Num CompareGtE NameLoad NameLoad body Break Assign NameStore Call AttributeLoad NameLoad attr If BoolOpAnd CompareNotEq NameLoad Str Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Num orelse Expr Call AttributeLoad NameLoad attr NameLoad Break Return Call AttributeLoad Str attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body If CompareEq AttributeLoad NameLoad attr Str body TryExcept body Return Call AttributeLoad AttributeLoad NameLoad attr attr handlers ExceptHandler type NameLoad body Return Str orelse Assign TupleStore NameStore AttributeStore NameLoad attr TupleLoad AttributeLoad NameLoad attr Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr UnaryOpUSub Call NameLoad NameLoad Num decorator_list decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Yield NameLoad orelse Raise NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str TryExcept body Expr Call NameLoad NameLoad handlers ExceptHandler type NameLoad body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If BoolOpAnd Call NameLoad NameLoad Str Call NameLoad NameLoad Str body TryExcept body Expr Call AttributeLoad NameLoad attr Num Num Expr Call AttributeLoad NameLoad attr Num Num Return NameLoad handlers ExceptHandler type NameLoad body Pass Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body Return NameLoad orelse If Call NameLoad NameLoad body Return Call NameLoad NameLoad orelse If Call NameLoad NameLoad body Return Call NameLoad NameLoad orelse Raise NameLoad BinOpMod Str NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body If CompareLt AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body AugAssignAdd AttributeStore NameLoad attr Call NameLoad NameLoad Return NameLoad orelse Return Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd AttributeLoad NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body AugAssignSub AttributeStore NameLoad attr Call NameLoad NameLoad Assert CompareGtE AttributeLoad NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str Pass decorator_list ClassDef bases NameLoad body Expr Str Pass decorator_list TryExcept body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad NameLoad NameLoad decorator_list handlers ExceptHandler body Expr NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call NameLoad Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Call NameLoad NameLoad body Expr Str Return CompareIn NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Break Return Call AttributeLoad Str attr NameLoad decorator_list Assign NameStore Call NameLoad Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad Str Assign NameStore Call NameLoad Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If NameLoad body Expr Call NameLoad NameLoad Assign NameStore ListLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad Num AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad TryExcept body Return Call NameLoad Call AttributeLoad Str attr NameLoad Num handlers ExceptHandler type NameLoad body If NameLoad body Return NameLoad Raise NameLoad BinOpMod Str Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad TryExcept body Return Call NameLoad Call AttributeLoad Str attr NameLoad Num handlers ExceptHandler type NameLoad body Raise NameLoad BinOpMod Str Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Assign NameStore ListLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr Str If BoolOpAnd NameLoad CompareEq SubscriptLoad NameLoad Index Num Str body AugAssignAdd NameStore Call AttributeLoad NameLoad attr Str AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad TryExcept body Return Call NameLoad Call AttributeLoad Str attr NameLoad NameLoad handlers ExceptHandler type NameLoad body Raise NameLoad BinOpMod Str Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body If NameLoad body Expr Call NameLoad NameLoad Assign NameStore ListLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr Str AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr Str AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad TryExcept body Return Call NameLoad Call AttributeLoad Str attr NameLoad handlers ExceptHandler type NameLoad body Raise NameLoad BinOpMod Str Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad Lambda arguments args NameParam defaults NameLoad NameLoad body Expr Str If NameLoad body Expr Call NameLoad NameLoad Assign NameStore ListLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr Lambda arguments args NameParam defaults UnaryOpNot Call NameLoad NameLoad If NameLoad body Return Call AttributeLoad Str attr NameLoad orelse If NameLoad body Return NameLoad Raise NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Return Call NameLoad NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If CompareEq NameLoad NameLoad body Return NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Return NameLoad Raise NameLoad BinOpMod Str TupleLoad NameLoad NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Return Call NameLoad Call NameLoad NameLoad NameLoad NameLoad decorator_list Return NameLoad decorator_list Expr Str Assign NameStore Call NameLoad NameLoad Num keyword NameLoad FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam defaults body Expr Call NameLoad NameLoad Return NameLoad decorator_list Return NameLoad decorator_list ClassDef bases body FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore ListLoad TryExcept body For NameStore AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return Call NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Raise NameLoad TupleLoad NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad Assign NameStore Call NameLoad NameLoad While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If CompareEq NameLoad Str body Break If Call NameLoad NameLoad body Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr Call NameLoad Call NameLoad NameLoad Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body FunctionDef arguments args defaults body Assign NameStore Call NameLoad Str Return CompareEq Call NameLoad NameLoad keyword NameLoad Str decorator_list FunctionDef arguments args defaults body Return Call NameLoad NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args defaults body Return Call AttributeLoad NameLoad attr decorator_list Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If NameLoad body Return NameLoad orelse Raise NameLoad BinOpMod Str NameLoad decorator_list Assign NameStore Dict Str Str Str Str Str Str Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Call NameLoad Call NameLoad Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults body If NameLoad body Return Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body If CompareNotEq NameLoad NameLoad body Return Call NameLoad NameLoad NameLoad keyword NameLoad Return NameLoad decorator_list If CompareEq NameLoad Str body If CompareEq NameLoad NameLoad body Return Call NameLoad NameLoad orelse Return Call NameLoad Call NameLoad NameLoad NameLoad keyword NameLoad If CompareIn NameLoad NameLoad body Return Call NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad orelse Return NameLoad decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam defaults body Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str For NameStore Call NameLoad Str body Expr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Call NameLoad Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Call NameLoad Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Call NameLoad Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Call NameLoad Str Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Lambda arguments args NameParam defaults CompareEq NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Str Num Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Num Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Num Num Num Call NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Call NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Call NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Import alias Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str Call NameLoad NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr TupleLoad Num Call NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Num Num Num Num Num Num Call NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Num Num Num Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Num Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Str Expr Call AttributeLoad NameLoad attr TupleLoad Str Num Num Call NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str decorator_list decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr
N/A N/A scanf.py: scanf-style input for Python.

Danny Yoo (dyoo@hkn.eecs.berkeley.edu)

The initial motivation for this module was based on a posting on
Python-tutor:

    http://mail.python.org/pipermail/tutor/2004-July/030480.html

I haven't been able to find a nice module to do scanf-style input.
Even the Library Reference recommends regular expressions as a
substitute:

    http://docs.python.org/lib/node109.html

But there appears to have been activity about this on python-list:

    http://aspn.activestate.com/ASPN/Mail/Message/python-list/785450


Still, let's see if we can get a close equivalent scanf() in place.
At the least, it'll be fun for me, and it might be useful for people
who are still recovering from C.  *grin*


Functions provided:

    scanf(formatString) -- formatted scanning across stdin

    sscanf(sourceString, formatString) -- formated scanning across strings

    fscanf(sourceFile, formatString) -- formated scanning across files


The behavior of this scanf() will be slightly different from that
defined in C, because, in truth, I'm a little lazy, and am not quite
sure if people will need all of scanf's features in typical Python
programming.


But let's first show what conversions this scanf() will support.
Format strings are of the following form:

    % [*] [width] [format]

where [*] and [width] are optional, and [format] is mandatory.  The
optional flags modify the format.

    *         suppresses variable capture.
    width     maximum character width.


We support the following scanf conversion formats (copied from K&R):

    d    decimal integer.

    i    integer.  The integer may be in octal (leading zero) or
         hexadecimal (leading 0x or 0X).  ## fixme

    o    octal integer (with or without leading zero).  ## fixme

    x    hexadecimal integer (with or without leading 0x or 0X)   ## fixme

    c    characters.  The next input characters (default 1) are
         placed at the indicated spot.  The normal skip over white space
         is suppressed; to read the next non-white space character, use
         %1s.

    s    character string (not quoted).

    f    floating-point number with optional sign and optional decimal point.

    %    literal %; no assignment is made.


Literal characters can appear in the scanf format string: they must
match the same characters in the input.

There is no guarantee of what happens if calls to scanf are mixed with
other input functions.  See the BUGS section below for details on this.


If the input doesn't conform to the format string, a FormatError is
raised.


Example format strings:

    "%d %d"         Two decimal integers.

    "%d.%d.%d.%d"   Four decimal integers, separated by literal periods.
                    The periods won't be captured.

    "hello %s"      Literally matches "hello" followed by any number of
                    spaces, followed by a captured word.


There's also an interface for calling the internal function bscanf()
that works on CharacterBuffer types, if in the future there is
something that supports getc() and ungetc() natively.  There's also an
undocumented compile() function that takes format strings and returns
a function that can scan through CharacterBuffers.  Ooops, I guess I
just documented it.  *grin*


######################################################################


BUGS and GOTCHAS:

One major problem that I'm running into is a lack of ungetc(); it
would be nice if there were such a function in Python, but I can't
find it.  I have to simulate it by using a CharacterBuffer object, but
it's not an ideal solution.

So at most, you may lose a single character to the internal buffers
maintained by this module if you use scanf().  The other two *scanf()
functions, thankfully, aren't effected by this problem, since I can
simulate ungetc() more accurately by using seek() in the other two
cases.

If you really need to get that buffered character back, you can grab
it through _STDIN.lastChar, though manually fiddling with this is not
recommended.

So use scanf() with the following caveat: unlike C's stdin(), this
version scanf() can't be interchanged with calls to other input
functions without some kind of weird side effect.  We keep a
one-character buffer into stdin, so at most you might lose one
character to the internal buffers.

fscanf() is only allowed to work on things that support both read(1)
and seek(1, -1), since then I can reliably do a ungetch-like thing.

scanf("%s") can be dangerous in a hostile environment, since it's very
possible for something to pass in a huge string without spaces.  So use
an explicit width instead if you can help it. N/A sys N/A unittest string whitespace WHITESPACE string digits DIGITS N/A __all__ N/A scanf sscanf fscanf N/A __version__ 1.0 CharacterBuffer N/A object N/A N/A A CharacterBuffer allows us to get a character, and to "unget" a
    character.  Abstract class getch N/A N/A self N/A N/A N/A Returns the next character.  If there are no more characters
        left in the stream, returns the empty string. N/A N/A ungetch N/A N/A self ch N/A N/A N/A Tries to put back a character.  Can be called at most once
        between calls to getch(). N/A N/A scanCharacterSet N/A N/A self characterSet maxChars N/A 0 N/A N/A Support function that scans across a buffer till we hit
        something outside the allowable characterSet. N/A N/A N/A self scanPredicate N/A N/A N/A ch N/A N/A ch characterSet maxChars N/A scanPredicate N/A N/A self predicate maxChars N/A 0 N/A N/A Support function that scans across a buffer till we hit
        something outside what's allowable by the predicate. N/A chars N/A N/A countChars 0 N/A True N/A N/A N/A N/A maxChars 0 N/A countChars maxChars N/A N/A N/A ch N/A N/A self getch N/A N/A N/A ch N/A predicate ch N/A N/A N/A N/A chars append ch N/A countChars 1 N/A N/A N/A N/A self ungetch ch N/A N/A N/A N/A join chars N/A N/A CharacterBufferFromIterable N/A CharacterBuffer N/A N/A Implementation of CharacterBuffers for iterable things.
    We keep a 'lastChar' attribute to simulate ungetc(). __init__ N/A N/A self iterable N/A N/A N/A N/A self iterator N/A iter iterable N/A N/A self lastChar N/A getch N/A N/A self N/A N/A N/A N/A N/A self lastChar N/A N/A N/A N/A N/A N/A N/A self iterator next N/A N/A N/A StopIteration N/A N/A N/A N/A N/A ch N/A self lastChar N/A N/A self lastChar N/A ch N/A ungetch N/A N/A self ch N/A N/A N/A N/A self lastChar ch N/A N/A CharacterBufferFromFile N/A CharacterBuffer N/A N/A Implementation of CharacterBuffers for files.  We use the native
    read(1) and seek() calls, so we don't have to do so much magic. __init__ N/A N/A self myfile N/A N/A N/A N/A self myfile myfile N/A getch N/A N/A self N/A N/A N/A N/A N/A N/A self myfile read 1 N/A ungetch N/A N/A self ch N/A N/A N/A N/A N/A N/A self myfile seek N/A N/A len ch 1 N/A N/A readiter N/A N/A inputFile N/A args N/A N/A Returns an iterator that calls read(*args) on the inputFile. N/A True N/A N/A ch N/A N/A inputFile read args N/A ch N/A N/A N/A ch N/A N/A StopIteration N/A isIterable N/A N/A thing N/A N/A N/A Returns true if 'thing' looks iterable. N/A N/A N/A N/A iter thing N/A N/A N/A TypeError N/A N/A False N/A True N/A isFileLike N/A N/A thing N/A N/A N/A Returns true if thing looks like a file. N/A N/A N/A hasattr thing read N/A hasattr thing seek N/A N/A N/A N/A N/A N/A thing seek 1 1 N/A N/A N/A thing seek -1 1 N/A True N/A N/A N/A IOError N/A N/A N/A False N/A makeCharBuffer N/A N/A thing N/A N/A N/A Try to coerse 'thing' into a CharacterBuffer.  'thing' can be
    an instance of:

        1.  CharacterBuffer
        2.  A file-like object,
        3.  An iterable.

    makeCharBuffer() will make guesses in that order.
     N/A N/A isinstance thing CharacterBuffer N/A N/A thing N/A N/A N/A isFileLike thing N/A N/A N/A CharacterBufferFromFile thing N/A N/A N/A isIterable thing N/A N/A N/A CharacterBufferFromIterable thing N/A N/A ValueError N/A Can't coerse %r to CharacterBuffer thing N/A CappedBuffer N/A CharacterBuffer N/A N/A Implementation of a buffer that caps the number of bytes we can
    getch().  The cap may or may not include whitespace characters. __init__ N/A N/A self buffer width ignoreWhitespace N/A False N/A N/A N/A self buffer buffer N/A N/A self bytesRead 0 N/A N/A self width width N/A N/A self ignoreWhitespace ignoreWhitespace N/A getch N/A N/A self N/A N/A N/A N/A N/A self bytesRead N/A self width N/A N/A nextChar N/A N/A N/A self buffer getch N/A N/A N/A N/A self isIgnoredChar nextChar N/A N/A N/A self bytesRead N/A len nextChar N/A nextChar N/A N/A N/A isIgnoredChar N/A N/A self ch N/A N/A N/A N/A N/A self ignoreWhitespace N/A isWhitespaceChar ch N/A ungetch N/A N/A self ch N/A N/A N/A N/A N/A N/A self buffer ungetch ch N/A N/A N/A N/A self isIgnoredChar ch N/A N/A N/A self bytesRead N/A len ch N/A N/A N/A self bytesRead 0 N/A N/A FormatError N/A ValueError N/A N/A A FormatError is raised if we run into errors while scanning
    for input. N/A N/A IncompleteCaptureError N/A ValueError N/A N/A The *scanf() functions raise IncompleteCaptureError if a problem
    occurs doing scanning. N/A N/A N/A N/A N/A We keep a module-level STDIN CharacterBuffer, so that we can call
    scanf() several times and not lose characters between invocations. N/A _STDIN N/A CharacterBufferFromIterable N/A sys stdin scanf N/A N/A formatString N/A N/A N/A scanf(formatString) -> tuple

    Scans standard input for formats specified in the formatString.  See
    module's docs for list of supported format characters. N/A N/A bscanf _STDIN formatString N/A N/A N/A N/A N/A TypeError sscanf N/A N/A inputString formatString N/A N/A N/A sscanf(inputString, formatString) -> tuple

Scans inputString for formats specified in the formatString.  See
module's docs for list of supported format characters. N/A N/A bscanf N/A CharacterBufferFromIterable inputString formatString N/A fscanf N/A N/A inputFile formatString N/A N/A N/A fscanf(inputFile, formatString) -> tuple

Scans inputFile for formats specified in the formatString.  See
module's docs for list of supported format characters. N/A buffer N/A CharacterBufferFromFile inputFile N/A N/A bscanf buffer formatString N/A bscanf N/A N/A buffer formatString N/A N/A N/A fscanf(buffer, formatString) -> tuple

Scans a CharacterBuffer 'buffer' for formats specified in the
formatString.  See scanf module's docs for list of supported format
characters. N/A parser N/A compile formatString N/A N/A parser buffer N/A isWhitespaceChar N/A N/A ch _set N/A N/A set WHITESPACE N/A N/A Returns true if the charcter looks like whitespace.
    We follow the definition of C's isspace() function.
     N/A N/A ch _set N/A handleWhitespace N/A N/A buffer N/A N/A N/A Scans for whitespace.  Returns all the whitespace it collects. N/A chars N/A N/A True N/A N/A ch N/A N/A buffer getch N/A N/A isWhitespaceChar ch N/A N/A N/A N/A chars append ch N/A N/A N/A N/A buffer ungetch ch N/A N/A N/A N/A join chars N/A N/A _PLUS_MINUS_SET N/A set +- N/A _DIGIT_SET N/A set DIGITS N/A _OCT_SET N/A set 01234567 N/A _HEX_SET N/A set 0123456789ABCDEFabcdef handleDecimalInt N/A N/A buffer optional allowLeadingWhitespace N/A False True N/A N/A Tries to scan for an integer.  If 'optional' is set to False,
    returns None if an integer can't be successfully scanned. N/A allowLeadingWhitespace N/A N/A N/A handleWhitespace buffer N/A chars N/A N/A chars N/A N/A buffer scanCharacterSet _PLUS_MINUS_SET 1 N/A chars N/A N/A buffer scanCharacterSet _DIGIT_SET N/A N/A N/A N/A int N/A N/A join chars 10 N/A N/A N/A ValueError N/A N/A optional N/A N/A None N/A FormatError N/A invalid literal characters: %s N/A N/A join chars N/A handleOct N/A N/A buffer N/A N/A N/A chars N/A N/A chars N/A N/A buffer scanCharacterSet _PLUS_MINUS_SET N/A chars N/A N/A buffer scanCharacterSet _OCT_SET N/A N/A N/A N/A int N/A N/A join chars 8 N/A N/A N/A ValueError N/A N/A FormatError N/A invalid literal characters: %s N/A N/A join chars N/A handleInt N/A N/A buffer base N/A 0 N/A N/A chars N/A N/A chars N/A N/A buffer scanCharacterSet _PLUS_MINUS_SET N/A chars N/A N/A buffer scanCharacterSet 0 N/A N/A chars N/A N/A chars N/A -1 0 N/A N/A chars N/A N/A buffer scanCharacterSet xX N/A chars N/A N/A buffer scanCharacterSet _HEX_SET N/A N/A N/A N/A int N/A N/A join chars base N/A N/A N/A ValueError N/A N/A FormatError N/A invalid literal characters: %s N/A N/A join chars N/A handleHex N/A N/A buffer N/A N/A N/A N/A handleInt buffer 16 N/A handleFloat N/A N/A buffer allowLeadingWhitespace N/A True N/A N/A allowLeadingWhitespace N/A N/A N/A handleWhitespace buffer N/A chars N/A N/A chars N/A N/A buffer scanCharacterSet _PLUS_MINUS_SET N/A chars N/A N/A buffer scanCharacterSet _DIGIT_SET N/A chars N/A N/A buffer scanCharacterSet . N/A chars N/A N/A buffer scanCharacterSet _DIGIT_SET N/A chars N/A N/A buffer scanCharacterSet eE N/A chars N/A N/A buffer scanCharacterSet _PLUS_MINUS_SET N/A chars N/A N/A buffer scanCharacterSet _DIGIT_SET N/A N/A N/A N/A float N/A N/A join chars N/A N/A N/A ValueError N/A N/A FormatError N/A invalid literal characters: %s N/A N/A join chars N/A handleChars N/A N/A buffer allowLeadingWhitespace isBadCharacter optional N/A False N/A N/A N/A ch N/A False False N/A N/A Read as many characters are there are in the buffer. N/A allowLeadingWhitespace N/A N/A N/A handleWhitespace buffer N/A chars N/A N/A chars N/A N/A buffer scanPredicate N/A N/A N/A ch N/A N/A N/A isBadCharacter ch N/A chars N/A N/A N/A N/A join chars N/A N/A optional N/A N/A None N/A FormatError Empty buffer. N/A handleString N/A N/A buffer allowLeadingWhitespace N/A True N/A N/A Reading a string format is just an application of reading
    characters (skipping leading spaces, and reading up to space). N/A N/A handleChars buffer allowLeadingWhitespace allowLeadingWhitespace isBadCharacter isWhitespaceChar N/A makeHandleLiteral N/A N/A literal N/A N/A f N/A N/A buffer optional N/A False N/A N/A ch N/A N/A buffer getch N/A N/A ch literal N/A N/A ch N/A N/A N/A N/A buffer ungetch ch N/A optional N/A N/A None N/A FormatError N/A %s != %s N/A literal ch N/A N/A f N/A makeWidthLimitedHandler N/A N/A handler width ignoreWhitespace N/A False N/A N/A Constructs a Handler that caps the number of bytes that can be read
    from the byte buffer. f N/A N/A buffer N/A N/A N/A N/A handler N/A CappedBuffer buffer width ignoreWhitespace N/A N/A f N/A N/A Just for kicks: handleChar is a handler for a single character. N/A handleChar N/A makeWidthLimitedHandler handleChars 1 ignoreWhitespace False makeIgnoredHandler N/A N/A handler N/A N/A f N/A N/A buffer N/A N/A N/A N/A handler buffer N/A None N/A N/A f N/A CompiledPattern N/A N/A __init__ N/A N/A self handlers formatString N/A N/A N/A N/A self handlers handlers N/A N/A self formatString formatString N/A __call__ N/A N/A self buffer N/A N/A N/A results N/A N/A N/A N/A h N/A self handlers N/A N/A value N/A h buffer N/A N/A value None N/A N/A N/A N/A results append value N/A N/A tuple results N/A N/A N/A FormatError N/A e N/A N/A IncompleteCaptureError N/A e N/A tuple results N/A __repr__ N/A N/A self N/A N/A N/A N/A compile(%r) N/A self formatString N/A N/A compile N/A N/A formatString N/A N/A N/A Given a format string, emits a new CompiledPattern that eats
    CharacterBuffers and returns captured values as a tuple.

    If there's a failure during scanning, raises IncompleteCaptureError,
    with args being a two-tuple of the FormatError, and the results that
    were captured before the error occurred.
     N/A handlers N/A N/A formatBuffer N/A CharacterBufferFromIterable formatString N/A True N/A N/A ch N/A N/A formatBuffer getch N/A N/A ch N/A N/A N/A N/A isWhitespaceChar ch N/A N/A N/A handleWhitespace formatBuffer N/A N/A N/A handlers append N/A makeIgnoredHandler handleWhitespace N/A N/A N/A ch % N/A N/A N/A N/A handlers append N/A _compileFormat formatBuffer N/A N/A N/A N/A handlers append N/A makeIgnoredHandler N/A makeHandleLiteral ch N/A N/A CompiledPattern handlers formatString N/A _compileFormat N/A N/A formatBuffer N/A N/A readOptionalSuppression N/A N/A N/A N/A N/A f N/A makeHandleLiteral * N/A N/A N/A f formatBuffer optional True * N/A readOptionalWidth N/A N/A N/A N/A N/A N/A handleDecimalInt formatBuffer optional True allowLeadingWhitespace False N/A readFormat N/A N/A N/A N/A N/A N/A N/A formatBuffer getch N/A N/A suppression N/A readOptionalSuppression N/A width N/A readOptionalWidth N/A formatCh N/A readFormat N/A handler N/A makeFormattedHandler suppression width formatCh N/A handler N/A N/A handler N/A N/A FormatError N/A Invalid format character %s formatCh N/A N/A _FORMAT_HANDLERS N/A d i x o s f % handleDecimalInt handleInt handleHex handleOct handleString handleFloat N/A makeIgnoredHandler N/A makeHandleLiteral % makeFormattedHandler N/A N/A suppression width formatCh N/A N/A N/A Given suppression, width, and a formatType, returns a function
    that eats a buffer and returns that thing. applySuppression N/A N/A handler N/A N/A N/A suppression N/A N/A N/A makeIgnoredHandler handler N/A handler N/A applyWidth N/A N/A handler N/A N/A N/A N/A width None N/A N/A N/A makeWidthLimitedHandler handler width ignoreWhitespace True N/A handler N/A N/A N/A formatCh c N/A N/A N/A width None N/A N/A N/A applySuppression handleChar N/A N/A N/A applySuppression N/A makeWidthLimitedHandler handleChars width ignoreWhitespace False N/A N/A formatCh _FORMAT_HANDLERS N/A N/A N/A applySuppression N/A applyWidth N/A _FORMAT_HANDLERS N/A formatCh N/A N/A None N/A ScanfTests N/A N/A unittest TestCase N/A bufferFromString N/A N/A self s N/A N/A N/A N/A CharacterBufferFromIterable s N/A testBufferFromString N/A N/A self N/A N/A N/A b N/A N/A self bufferFromString hello N/A letter N/A list hello N/A N/A N/A N/A self assertEquals letter N/A N/A b getch N/A N/A N/A self assertEquals N/A N/A b getch N/A testCharacterSetScanning N/A N/A self N/A N/A N/A b N/A makeCharBuffer +++-+++++1234 N/A N/A N/A self assertEquals +++ N/A N/A b scanCharacterSet N/A set + N/A N/A N/A self assertEquals N/A N/A b scanCharacterSet N/A set + N/A N/A N/A self assertEquals - N/A N/A b scanCharacterSet N/A set - N/A N/A N/A self assertEquals + N/A N/A b scanCharacterSet N/A set + 1 N/A testPredicateScanning N/A N/A self N/A N/A N/A b N/A makeCharBuffer +++-+++++1234 N/A N/A N/A self assertEquals +++ N/A N/A b scanPredicate N/A N/A N/A ch N/A N/A ch + N/A testUngetch N/A N/A self N/A N/A N/A b N/A N/A self bufferFromString ong N/A N/A N/A b ungetch y N/A N/A N/A self assertEquals y N/A N/A b getch N/A N/A N/A self assertEquals o N/A N/A b getch N/A N/A N/A b ungetch u N/A N/A N/A self assertEquals u N/A N/A b getch N/A N/A N/A self assertEquals n N/A N/A b getch N/A N/A N/A self assertEquals g N/A N/A b getch N/A N/A N/A self assertEquals N/A N/A b getch N/A testRepeatedGetchOnEmptyStreamIsOk N/A N/A self N/A N/A N/A b N/A N/A self bufferFromString N/A N/A N/A self assertEquals N/A N/A b getch N/A N/A N/A self assertEquals N/A N/A b getch N/A testCappedBuffer N/A N/A self N/A N/A N/A b N/A CappedBuffer N/A N/A self bufferFromString supercalifragilisticexpialidocious 5 N/A N/A N/A self assertEquals s N/A N/A b getch N/A N/A N/A self assertEquals u N/A N/A b getch N/A N/A N/A self assertEquals p N/A N/A b getch N/A N/A N/A self assertEquals e N/A N/A b getch N/A N/A N/A self assertEquals r N/A N/A b getch N/A N/A N/A self assertEquals N/A N/A b getch N/A N/A N/A self assertEquals N/A N/A b getch N/A N/A N/A b ungetch r N/A N/A N/A self assertEquals r N/A N/A b getch N/A N/A N/A self assertEquals N/A N/A b getch N/A testWhitespaceScanning N/A N/A self N/A N/A N/A b N/A N/A self bufferFromString     42
43 N/A N/A N/A self assertEquals N/A handleWhitespace b N/A N/A N/A self assertEquals N/A handleWhitespace b N/A N/A N/A self assertEquals 4 N/A N/A b getch N/A testDecimalDigitScanning N/A N/A self N/A N/A N/A b N/A N/A self bufferFromString 42 43!44 N/A N/A N/A self assertEquals 42 N/A handleDecimalInt b N/A N/A N/A self assertEquals N/A handleWhitespace b N/A N/A N/A self assertEquals 43 N/A handleDecimalInt b N/A b2 N/A N/A self bufferFromString -1-2+3-4 N/A N/A N/A self assertEquals -1 N/A handleDecimalInt b2 N/A N/A N/A self assertEquals -2 N/A handleDecimalInt b2 N/A N/A N/A self assertEquals 3 N/A handleDecimalInt b2 N/A N/A N/A self assertEquals -4 N/A handleDecimalInt b2 N/A N/A N/A self assertRaises FormatError handleDecimalInt b2 N/A testCharacter N/A N/A self N/A N/A N/A b N/A N/A self bufferFromString hi! N/A N/A N/A self assertEquals h N/A handleChar b N/A N/A N/A self assertEquals i N/A handleChar b N/A N/A N/A self assertEquals ! N/A handleChar b N/A N/A N/A self assertRaises FormatError handleChar b N/A testString N/A N/A self N/A N/A N/A b N/A N/A self bufferFromString -42 + 1 equals -41 N/A N/A N/A self assertEquals -42 N/A handleString b N/A N/A handleWhitespace b N/A N/A N/A self assertEquals + N/A handleString b N/A N/A handleWhitespace b N/A N/A N/A self assertEquals 1 N/A handleString b N/A N/A handleWhitespace b N/A N/A N/A self assertEquals equals N/A handleString b N/A N/A handleWhitespace b N/A N/A N/A self assertEquals -41 N/A handleString b N/A testIntegerScanning N/A N/A self N/A N/A N/A N/A N/A self assertEquals N/A 42 43 N/A sscanf    42
   43   %d %d N/A N/A N/A self assertEquals N/A 8 N/A sscanf 10 %o N/A N/A N/A self assertEquals N/A 8 N/A sscanf 010 %o N/A N/A N/A self assertEquals N/A 15 N/A sscanf F %x N/A N/A N/A self assertEquals N/A 15 N/A sscanf f %x N/A N/A N/A self assertEquals N/A 15 N/A sscanf 0xF %x N/A N/A N/A self assertEquals N/A 15 N/A sscanf 0XF %x N/A N/A N/A self assertEquals N/A 15 N/A sscanf 0Xf %x N/A N/A N/A self assertEquals N/A -1 -2 3 -4 N/A sscanf -1-2+3-4 %d%d%d%d N/A testWordScanning N/A N/A self N/A N/A N/A N/A N/A self assertEquals N/A hello world N/A sscanf    hello world %s %s N/A testSuppression N/A N/A self N/A N/A N/A N/A N/A self assertEquals N/A N/A sscanf  hello world %*s %*s N/A N/A N/A self assertEquals N/A happy N/A sscanf hello happy world %*s %s %*s N/A N/A N/A self assertEquals N/A N/A sscanf h %*c N/A testWidth N/A N/A self N/A N/A N/A N/A N/A self assertEquals N/A 00010 N/A sscanf 00010101010111 %5c N/A N/A N/A self assertEquals N/A xy N/A sscanf xyz %2s N/A N/A N/A self assertEquals N/A xy N/A sscanf               xyz %2s N/A N/A N/A self assertEquals N/A N/A sscanf               xyz %2c N/A testFscanf N/A N/A self N/A N/A N/A StringIO N/A b N/A N/A StringIO StringIO hello world N/A N/A N/A self assertEquals N/A hello world N/A fscanf b %s%c%s N/A b2 N/A N/A StringIO StringIO hello world N/A N/A N/A self assertEquals N/A hello N/A fscanf b2 %s N/A N/A N/A self assertEquals N/A N/A fscanf b2 %c N/A N/A N/A self assertEquals N/A world N/A fscanf b2 %s N/A testSkipLeadingSpaceOnScanning N/A N/A self N/A N/A N/A Ralph Heinkel reported a bug where floats weren't being
        parsed properly if there were leading whitespace for %f.
        This case checks that N/A N/A N/A self assertEquals N/A 42.0 N/A sscanf     42.0 %f N/A testFloats N/A N/A self N/A N/A N/A N/A N/A self assertEquals N/A 3.14 10.0 0.001 1e+100 3.14e-10 0.0 N/A sscanf 3.14
                           10.
                           .001
                           1e100
                           3.14e-10
                           0e0 %f %f %f %f %f %f N/A testMoreSimpleScanningExamples N/A N/A self N/A N/A N/A N/A N/A self assertEquals N/A 192 168 1 1 N/A sscanf 192.168.1.1 %d.%d.%d.%d N/A N/A N/A self assertEquals N/A a b c N/A sscanf   ab   c   %1s%1s%s N/A N/A N/A self assertEquals N/A hello world N/A sscanf hello world %s%c%s N/A N/A N/A self assertRaises IncompleteCaptureError sscanf 192.168.1.1 %d %d %d %d N/A N/A N/A self assertEquals N/A danny N/A sscanf hi danny hi %s N/A N/A N/A self assertEquals N/A danny N/A sscanf   hi danny   hi %s N/A N/A N/A self assertEquals N/A a b 3 N/A sscanf ab3 %c%c%d N/A N/A N/A self assertRaises IncompleteCaptureError sscanf   hi danny hi %s N/A N/A N/A self assertEquals N/A /usr/bin/sendmail 0 4 N/A sscanf /usr/bin/sendmail - 0 errors, 4 warnings %s - %d errors, %d warnings N/A testErroneousFormats N/A N/A self N/A N/A N/A N/A N/A self assertRaises FormatError compile % N/A N/A N/A self assertRaises FormatError compile %  N/A N/A N/A self assertRaises FormatError compile %* N/A N/A N/A self assertRaises FormatError compile %*z N/A N/A N/A self assertRaises FormatError compile % d N/A N/A N/A self assertRaises FormatError compile %* d N/A N/A N/A N/A __name__ __main__ N/A N/A N/A N/A unittest main