
python
python
勇者lin
除了成功,别无选择。
展开
-
在linux中使用python+selenium+chrome+chromedriver报错:/opt/google/chrome is no longer running
处理这个问题的前提是已经安装好了chrome,以及对应的chromedriver问题:(The process started from chrome location /opt/google/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) 处理方式:该问题是因为在linux中python中selenium寻找chrome浏览器的默认地址为/opt/google/chrome,通原创 2021-08-31 23:14:46 · 5261 阅读 · 2 评论 -
使用Python爬虫调用谷歌翻译【21年8月】
使用Python爬虫调用谷歌翻译现在各大翻译平台工具,可能还得首推谷歌。昨天刚学习爬虫,所以用requests库写了一个可以调用的谷歌翻译类,使用者可以直接调用,默认翻译为英文,如果需要翻译为其他语言只需传递相应的参数即可。好了,话不多说直接上代码。import requestsclass TranslateByGoogle(): # 初始化信息 def __init__(self): self.__headers = { "User-A原创 2021-08-26 10:34:02 · 3674 阅读 · 13 评论 -
django中的path替代url匹配到首页
以前django使用的是url,匹配到首页的方式为urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', welcome) # 首页]使用path之后from django.contrib import adminfrom django.urls import pathfrom cms.views import welcomeurlpatterns = [ path('admin/', admin.原创 2021-07-21 22:50:42 · 544 阅读 · 0 评论