Reputation: 21298
I have seen this question, but I am having problems with the 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? Is this not supposed to work?
Upvotes: 2
Views: 1169
Reputation: 21298
I wrapped the parse module:
from parse import parse
parse("\"%s\"".replace("%s","{}"), "\"test\"").fixed
Upvotes: 2