Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用代码过程中遇到的问题 #8

Open
hd1968340 opened this issue Dec 13, 2022 · 0 comments
Open

使用代码过程中遇到的问题 #8

hd1968340 opened this issue Dec 13, 2022 · 0 comments

Comments

@hd1968340
Copy link

hd1968340 commented Dec 13, 2022

你好,使用代码过程中遇到了两个问题,不知道是否有解决的办法。
问题1:爬取过程中遇到“http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/36/3605.html
requests fail, retry!”
或者“Exception in thread Thread-8:
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\hp\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:/Users/hp/Desktop/python/pythonProject3/main.py", line 83, in getData
countyList = selector.xpath('//tr[@Class="countytr"]')
AttributeError: 'NoneType' object has no attribute 'xpath'”
我认为这可能是由于我爬取的次数过多,才出现这种情况。经过一段时间之后,再跑程序,该问题就解决了。不知道有没有更好的解决方法。
问题2:有一些行政区划代码没有链接,爬取的结果中没有包括这些码值,如“350527000000-金门县”、“350501000000-市辖区”。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant