如何解决开放函数路径包含“”时的python错误

2024-09-26 22:44:27 发布

您现在位置:Python中文网/ 问答频道 /正文

以下是错误代码

    savePath = "E:\\Desktop\\output\\?.html"
    file = open(savePath, 'wb')

运行后,错误消息如下:

Traceback (most recent call last):   File "Main.py", line 35, in
<module>
     crawler.testSaveContent("E:\\Desktop\\output\\?.html")   File 
"E:\Desktop\MyCrawler.py", line 77, in testSaveContent
     file = open(savePath, 'wb') OSError: [Errno 22] Invalid argument: 
'E:\\Desktop\\output\\?.html'

我的python版本是3.6.3


Tags: inpy消息outputhtml错误lineopen

热门问题