From f33be33854e991979fc8927279abc0cdb8ba2c82 Mon Sep 17 00:00:00 2001 From: libertyzhu Date: Mon, 25 Sep 2023 11:09:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AF=B9=E8=B1=A1demo?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...345\210\240\351\231\244\345\257\271\350\261\241.md" | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git "a/product/\345\255\230\345\202\250\344\270\216CDN/\345\257\271\350\261\241\345\255\230\345\202\250 4.0/SDK\346\226\207\346\241\243/Python SDK/\345\257\271\350\261\241\346\223\215\344\275\234/\345\210\240\351\231\244\345\257\271\350\261\241.md" "b/product/\345\255\230\345\202\250\344\270\216CDN/\345\257\271\350\261\241\345\255\230\345\202\250 4.0/SDK\346\226\207\346\241\243/Python SDK/\345\257\271\350\261\241\346\223\215\344\275\234/\345\210\240\351\231\244\345\257\271\350\261\241.md" index 84dae2e6013f..6e7415521d3b 100644 --- "a/product/\345\255\230\345\202\250\344\270\216CDN/\345\257\271\350\261\241\345\255\230\345\202\250 4.0/SDK\346\226\207\346\241\243/Python SDK/\345\257\271\350\261\241\346\223\215\344\275\234/\345\210\240\351\231\244\345\257\271\350\261\241.md" +++ "b/product/\345\255\230\345\202\250\344\270\216CDN/\345\257\271\350\261\241\345\255\230\345\202\250 4.0/SDK\346\226\207\346\241\243/Python SDK/\345\257\271\350\261\241\346\223\215\344\275\234/\345\210\240\351\231\244\345\257\271\350\261\241.md" @@ -110,19 +110,19 @@ client = CosS3Client(config) # 删除指定前缀 (prefix)的文件 bucket = 'examplebucket-1250000000' -is_over = False marker = '' prefix = 'root/logs' -while not is_over: +while True: response = client.list_objects(Bucket=bucket, Prefix=prefix, Marker=marker) if 'Contents' in response: for content in response['Contents']: print("delete object: ", content['Key']) client.delete_object(Bucket=bucket, Key=content['Key']) - if response['IsTruncated'] == 'false': - is_over = True - marker = response['Marker'] + if response['IsTruncated'] == 'false': + break + + marker = response['NextMarker'] ``` #### 全部参数请求示例