问题 I have this code that parses and processes normal "f-string" template strings (See the usage part below for an example): from string import Formatter import sys _conversions = {'a': ascii, 'r': repr, 's': str} def z(template, locals_=None): if locals_ is None: previous_frame = sys._getframe(1) previous_frame_locals = previous_frame.f_locals locals_ = previous_frame_locals # locals_ = globals() result = [] parts = Formatter().parse(template) for part in parts: literal_text, field_name, format