简体   繁体   English

boto3 中 generate_presigned_url 返回值的类型是什么?

[英]What's the type of return value from generate_presigned_url in boto3?

presigned_url_list = [s3_client.generate_presigned_url('get_object',
                                            Params={'Bucket': bucket,
                                                    'Key': content['Key']},
                                            ExpiresIn=600)
                                            for content in file_list['Contents']]
 return presigned_url_list

I get the presigned url by the function.我得到了 function 的预签名 url。

And it works but the result like this:它有效,但结果如下:

[
    "presigned url1",
    "presigned url2"
]

What's the type of return value?返回值的类型是什么?

I don't want to see [] and "" and the "," also.我也不想看到 [] 和 "" 以及 ","。

I want to print it like this>我想这样打印>

presigned url1
presigned url2
presigned url3
...
...

The [] , quotes and commas are simply the way that Python is printing the list. [] 、引号和逗号只是 Python 打印列表的方式。

To get one URL per line, you could just print it with:要获得每行一个 URL,您可以打印它:

for url in presigned_url_list:
  print(url)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM