python 有多行注释运行报错

在python 中写 这样的注释 用 vscode 运行会报错

#coding=utf-8
import json
from playwright.sync_api import sync_playwright


f = open('D:/threeday/backup-2.json',"r+")
urls = f.readlines()
print(json.loads(urls[0]))
with sync_playwright() as p:
    browser = p.chromium.launch()
    for url in urls[0]:
        page = browser.new_page()
        page.goto(url)


"""
λ python -m playwright install
Downloading chromium v844399 - 91 Mb [====================] 100% 0.0s
chromium v844399 downloaded to C:\Users\Administrator\AppData\Local\ms-playwright\chromium-844399
Downloading firefox v1225 - 75.1 Mb [====================] 100% 0.0s
firefox v1225 downloaded to C:\Users\Administrator\AppData\Local\ms-playwright\\firefox-1225
Downloading webkit v1423 - 38.2 Mb [====================] 100% 0.0s
webkit v1423 downloaded to C:\Users\Administrator\AppData\Local\ms-playwright\webkit-1423
"""

image.png

最佳答案

报错信息显示,你的 lambda 字符它不认,建议转义