1

我已经看到了这个问题,但是我遇到了顶级解决方案的问题。例如:

>>> 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"',))
>>> 

我究竟做错了什么?这不应该工作吗?

4

1 回答 1

1

我包装了解析模块

from parse import parse
parse("\"%s\"".replace("%s","{}"), "\"test\"").fixed
于 2012-10-12T10:43:38.090 回答