Error TypeError: 'method' object is not subscriptable in Flask

Error TypeError: 'method' object is not subscriptable in Flask

美好的一天!

所以,如果出现错误 TypeError: 'method' object is not subscriptable in Flas

,我需要做什么
file = flask.request.files.getlist['propert_photo[]']
TypeError: 'method' object is not subscriptable
<div class="form-group">
    <label for="exampleFormControlFile1">Фотографии</label>
    <input name = "propert_photo[]" type="file" accept="image/png" multiple="" class="form-control-file" id="exampleFormControlFile1">
</div>

请帮忙

file = flask.request.files.getlist['propert_photo[]']
应该是
file = flask.request.files.getlist('propert_photo[]')

getlist是一个方法,方法调用使用()而不是[]

Python中的“可订阅”指的是你是否可以在对象上使用方括号语法(如a[0])(或者换句话说:它是否实现了__getitem__() 方法)。实际上,method/function 对象不启用此语法。