|
class string.Formatter :
parse(format_string)
Loop over the format_string and return an iterable of tuples (literal_text, field_name, format_spec, conversion). This is used by vformat() to break th
estring in to either literal text, or replacement fields.
上这句话来自python的帮助文档,意思是Formatter 类的parse()函数返回一个可迭代元组,于是我做了如下实验:
>>> import string
>>> a=string.Formatter()
>>> a.parse('{1}zhwlyfx')
<formatteriterator object at 0x00A9C398>
请看上面执行完a.parse('{1}zhwlyfx')后没有返回一个元组啊,好像是个地址啊,难道这个地址是个可迭代元组吗。 |
|