我见过this question,但我遇到top solution的问题。 例如:
>>> 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"',))
>>>
我做错了什么?这不应该有用吗?
答案 0 :(得分:1)
我包裹了the parse module:
from parse import parse
parse("\"%s\"".replace("%s","{}"), "\"test\"").fixed