From 752e5376abbd51609e2ab21126a70d2c0bb07f5d Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Tue, 9 May 2023 15:56:17 +0200 Subject: [PATCH] Use idiomatic Python --- pypdf/_page.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pypdf/_page.py b/pypdf/_page.py index 3f2a7e309..4ddbfb62d 100644 --- a/pypdf/_page.py +++ b/pypdf/_page.py @@ -644,13 +644,11 @@ def _content_stream_rename( stream = ContentStream(stream, pdf) for operands, _operator in stream.operations: if isinstance(operands, list): - for i in range(len(operands)): - op = operands[i] + for i, op in enumerate(operands): if isinstance(op, NameObject): operands[i] = rename.get(op, op) elif isinstance(operands, dict): - for i in operands: - op = operands[i] + for i, op in operands.items(): if isinstance(op, NameObject): operands[i] = rename.get(op, op) else: