• 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. HDU 3183 - A Magic Lamp - [RMQ][ST算法]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3183 Problem DescriptionKiki likes traveling. One day ...

  2. 没有文件扩展js的脚本引擎

    没有文件扩展js的脚本引擎 没有文件扩展js的脚本引擎怎么解决_百度经验 https://jingyan.baidu.com/article/ff42efa93a7ad9c19e2202f0.html

  3. 【软件测试】Junit入门

    写在前面:本博客为本人原创,严禁任何形式的转载!本博客只允许放在博客园(.cnblogs.com),如果您在其他网站看到这篇博文,请通过下面这个唯一的合法链接转到原文! 本博客全网唯一合法URL:ht ...

  4. Chap3:区块链的衍生技术[《区块链中文词典》维京&甲子]

  5. Eclipse + ndk+ cocos2dx 调试Cocos2dx 程序

    本文是我自己尝试通过eclipse来在windows平台下搭建cocos2dx的过程,期间遇到了一些问题,都是通过网上借鉴别人的博文来解决的,下面也列出来这些参考文献.写下来的目的主要是自己以后要用的 ...

  6. ORACLE监听配置及测试实验

    实验一: 修改db_domain和service_name 我们将Db_name和Db_domain两个参数用'.'连接起来,表示一个数据库,并将该数据库的名称称为Global_name即等于serv ...

  7. json 脚本入库的几种方法

    json 脚本入库的几种方法,见代码: #-*- encoding: utf-8 -*- #第一种mongodb入库 # from pymongo import * # import json # c ...

  8. 10.0-uC/OS-III任务管理

    1.实时应用中一般将工作拆分为多个任务,每个任务都需要是可靠的.任务(也叫做线程)是简单的程序.单CPU中,在任何时刻只能是一个任务被执行. 2.uC/OS-III支持多任务且对任务数量没有限制, 任 ...

  9. svn 启动命令讲解

    svn默认端口是3690 svn启动命令详解 svn启动命令详解 svnserve --help usage: svnserve [-d | -i | -t | -X] [options] Valid ...

  10. android下的样式

    android中控件,假如我们把样式都写死在控件的配置文件上的话.一旦改动可谓牵一发而动千军.那么我们能够把样式写在style.xml文件里.然后引用,在API14以上版本号. 该文件位于values ...