Does sscanf work for Python (preferably py3k)?

I saw this question , but I'm having problems with top solution . For example:

>>> scanf.sscanf("\"test\"","\"%s\"") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "scanf.py", line 393, in sscanf return bscanf(CharacterBufferFromIterable(inputString), formatString) File "scanf.py", line 414, in bscanf return parser(buffer) File "scanf.py", line 577, in __call__ raise IncompleteCaptureError(e, tuple(results)) scanf.IncompleteCaptureError: (FormatError('" != ',), ('test"',)) >>> 

What am I doing wrong? Should this not work?

+1
python printf scanf
Oct 12
source share
1 answer

I wrapped the parsing module :

 from parse import parse parse("\"%s\"".replace("%s","{}"), "\"test\"").fixed 
+1
Oct 12 '12 at 10:43
source share



All Articles