1. 程式人生 > >python OSError: [Errno 22] Invalid argument: 'D:\crawlex01.html1'

python OSError: [Errno 22] Invalid argument: 'D:\crawlex01.html1'

python os pytho error: valid image invalid port logs http

import urllib.request

file = urllib.request.open("http://www.baidu.com")

data = file.read()

print(data)

fhandle = open("D:\crawle\html1","wb")

fhandle.write(data)

fhandle.close()

技術分享

然而在這時我運行時出錯了

只需如下添加即可

技術分享

python OSError: [Errno 22] Invalid argument: 'D:\\crawle\x01.html1'