如何使用正则表达式选择POST / GET参数列表?例如:
request.POST.regex(/^inputs_/)
答案 0 :(得分:2)
import re
input_keys = [key for key in request.POST if re.match(r"^inputs_", key)]
说,正则表达式在这里会有点过分:
input_keys = [key for key in request.POST if key.startswith("inputs_")]