line 39 f-string: unmatched '('
I get this error:
File "/content/./pdf2md.py", line 39
f'base64,{base64.b64encode(buffer.getvalue()).decode('utf8')}'
^^^^
SyntaxError: f-string: unmatched '('
The problem is with the use of single quotes inside an f-string, which ends the string prematurely. Here’s the corrected version of the problematic line:
`url_encoded_image = (
f'data:image/{page_image.format.lower()};'
f'base64,{base64.b64encode(buffer.getvalue()).decode("utf8")}'
)
`
0 条评论