在构建Web剪贴板以编译数据并输出为XLS格式时遇到错误; 当再次测试我希望从中删除的域列表时,程序在收到套接字错误时会出错.希望找到一个'if'语句,它将解析一个破碎的网站并继续我的while循环.有任何想法吗?
workingList = xlrd.open_workbook(listSelection)
workingSheet = workingList.sheet_by_index(0)
destinationList = xlwt.Workbook()
destinationSheet = destinationList.add_sheet('Gathered')
startX = 1
startY = 0
while startX != 21:
workingCell = workingSheet.cell(startX,startY).value
print ''
print ''
print ''
print workingCell
#Setup
preSite = 'http://www.'+workingCell
theSite = urlopen(preSite).read()
currentSite = BeautifulSoup(theSite)
destinationSheet.write(startX,0,workingCell)
Run Code Online (Sandbox Code Playgroud)
这是错误:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
homeMenu()
File "C:\Python27\farming.py", line 31, in homeMenu
openList()
File "C:\Python27\farming.py", line 79, in openList
openList()
File "C:\Python27\farming.py", line 83, in openList
openList() …Run Code Online (Sandbox Code Playgroud)