• Web Scraping爬虫  for Mac urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>

Solution:  if 1) does not work, then try to use 2).  Reference is here.

        1)

  pip install --upgrade certifi

        2)

open /Applications/Python\ 3.6/Install\ Certificates.command
  • if running a python file to use https call, have error like
    "SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661"

    Solution:

      then solve it by adding

configuration.verify_ssl = False

in the test file.
Then it will skip verifying SSL certificate when calling API from https server.

  • if running a python file to use https call, have the warning of InsecureRequestWarning

    Solution:

      then solve it by adding

import urllib3
urllib3.disable_warnings()

in the test file. 
Then it will skip warning.

  • Remove leading whitespace 去除string前面的空格

    Solution:

>>> '     hello world!'.lstrip()
'hello world!'
  • Web Scraping爬虫

    看网页编码方式( 一般为“utf-8”)

    Solution: F12功能键,即可使用开发者工具,在窗口console标签下,键入 "document.charset" 即可查看网页的编码方式

[Python] Frequently used method or solutions for issues的更多相关文章

  1. [JavaScript] Frequently used method or solutions for issues

    Get the file name from the file path Solution: var fileName = fullPath.replace(/^.*[\\\/]/, ''); // ...

  2. [CSS] Frequently used method or solutions for issues

    Stick button in right side in html Solution: //In the html <div class="float__button" & ...

  3. [Java] Frequently used method or solutions for issues

    模板: Split string into parts based on new line in java Solution:   Reference is here. 1) get out of t ...

  4. 关于Python的函数(Method)与方法(Function)

    先上结论: 函数(function)是Python中一个可调用对象(callable), 方法(method)是一种特殊的函数. 一个可调用对象是方法和函数,和这个对象无关,仅和这个对象是否与类或实例 ...

  5. Python tricks(2) -- method默认参数和闭包closure

    Python的method可以设置默认参数, 默认参数如果是可变的类型, 比如list, map等, 将会影响所有的该方法调用. 下面是一个简单的例子 def f(a=None, l=[]): if ...

  6. 2.Python函数/方法(method/function)详解

    1.什么是函数 它是一段功能代码,理解为一种功能行为,在内存中有空间区域,函数需要被调用才能执行(通过函数名来调用): 好处: 1).提高代码的复用性 2).提升代码的阅读性 3).增加代码的扩展性 ...

  7. [Python] String strip() Method

    Description The method strip() returns a copy of the string in which all chars have been stripped fr ...

  8. [Python] The get() method on Python dicts and its "default" arg

    # The get() method on dicts # and its "default" argument name_for_userid = { 382: "Al ...

  9. Python String startswith() Method

    一,摘自官方API  https://docs.python.org/3/library/stdtypes.html#methods str.startswith(prefix[, start[, e ...

随机推荐

  1. postgresql----条件表达式

    postgresql支持CASE,COALESCE,NULLIF,GREATEST,LEAST条件表达式,使用它们有时候可以简化许多功能实现. 测试表 test),sex )); CREATE TAB ...

  2. 转:关于ROWNUM的使用

    转载自:原文:https://blog.csdn.net/songsenkeji/article/details/4432942 ROWNUM的概念ROWNUM是一个虚假的列.它将被分配为 1,2,3 ...

  3. {Django基础十之Form和ModelForm组件}一 Form介绍 二 Form常用字段和插件 三 From所有内置字段 四 字段校验 五 Hook钩子方法 六 进阶补充 七 ModelForm

    Django基础十之Form和ModelForm组件 本节目录 一 Form介绍 二 Form常用字段和插件 三 From所有内置字段 四 字段校验 五 Hook钩子方法 六 进阶补充 七 Model ...

  4. React组件的State

    React组件的State 1.正确定义State React把组件看成一个状态机.通过与用户的交互,实现不同状态,然后渲染UI,让用户界面和数据保持一致.组件的任何UI改变,都可以从State的变化 ...

  5. python-爬虫:取qq号中各分组成员信息存入数据库,并将qq头像下载保存到文件夹,图片命名为qq号(实例3)

    import requestsimport pymongoimport requestsimport os class QqGroup:#三个接口url 获取 qq组号 获取每组成员信息 获取qq头像 ...

  6. zookeeper集群扩容/下线节点实践

    环境:zookeeper版本 3.4.6jdk版本 1.7.0_8010.111.1.29 zk110.111.1.44 zk210.111.1.45 zk310.111.1.46 zk410.111 ...

  7. static的含义

    static的含义:(1)设置变量的存储域,函数体内static变量的作用范围为该函数体,不同于auto变量,该变量的内存只被分配一次,因此其值在下次调用时仍持上次的值:(2)限制变量的作用域,在模块 ...

  8. 把MP3保存到数据库中

    使用JdbcUtils得到连接con java.sql包下的Interface Blob----其实现类SerialBlob Blob是一个可以存储二进制文件的容器. BLOB常常是数据库中用来存储二 ...

  9. java装配bean

    java装配bean,可以自动装配,也可以显式装配: 1.通过组件扫描自动装配bean 因为使用了Configuration注解,表明这个类是一个配置类,该类应该包含在spring应用上下文如何创建b ...

  10. 微信公众号ID也可以修改了!

    差不多一年前,微信团队宣布个人类帐号一个自然年内可主动修改两次名称,那一天大家奔走相告纷纷修改成自己早就心仪的名字,有人猛然发现公众号名字改了,可ID还是xiaopipi(小屁屁)这可如何是好,洗不去 ...