我知道在PHP中,我可以使用 $ _ GET ['key1'] ['key2'] 来检索以数组形式发送的GET数据。是Python中可能的东西,因为我刚刚收到一个字符串,它不被识别为一个数组/列表。
如果有问题,我使用flask / werkzeug。
解决方案参数名称的深度解析对于PHP AFAIK是独一无二的。只需要一个简单的列表,只需传递几个具有相同名称的参数并使用 request.args.getlist(< paramname>)( documentation )。
否则你有自己解析查询字符串。
I know in php I could just use $_GET['key1']['key2'] to retrieve GET data that is sent in the form of an array but is that something possible in Python as I just receive a string and it's not recognized as an array/list.
I use flask/werkzeug if that matters.
解决方案The deep parsing of argument names is unique for PHP AFAIK.
If you need just a simple list, just pass several parameters with the same name and use request.args.getlist(<paramname>) (documentation).
Otherwise you have to parse the query string yourself.
更多推荐
在Python中获取数组作为GET查询参数
发布评论