给定格式化字符串:
x = "hello %(foo)s there %(bar)s"
有没有办法获取格式变量的名称?(不自己直接解析它们).
使用正则表达式不会太难,但我想知道是否有更直接的方法来获得这些.
python string python-2.x
python ×1
python-2.x ×1
string ×1