• 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. Ingeter与int的比较

    ,Ingeter是int的包装类,int的初值为0,Ingeter的初值为null.但是如果面试官再问一下Integer i = 1;int ii = 1; i==ii为true还是为false? 首 ...

  2. ElasticSearch入门 第六篇:复合数据类型——数组,对象和嵌套

    这是ElasticSearch 2.4 版本系列的第六篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch ElasticSearch入门 第二篇:集群配置 E ...

  3. IIS 使用域账户访问SQL 需要配置

    打开应用程序的 Web.config 文件并添加以下元素:   <authentication mode="Windows" /> <identity imper ...

  4. PAT甲级1013-1014-1015

    题目:1013 Battle Over Cities 思路:城市数也就1000, 对于每次询问暴力bfs一下看一下有多少连通块就行了.答案就是联通块数减一. #include<stdio.h&g ...

  5. 网易云信&七鱼市场总监姜菡钰:实战解读增长黑客在B端业务的运用

    近些年 ,随着互联网的迅速崛起,“增长黑客”一词逐渐映入大众的眼帘,并成为了最热门的话题之一.从2018年开始,线上流量触达天花板,引流之争的激烈程度空前高涨,企业为了获得更多的关注,产品的比拼.流量 ...

  6. 大疆OSMO口袋云台相机惊艳上市!友商该如何是好。。。

    2018.11.29 晚上更新: 下午看了大疆新出的口袋云台摄像机,感觉棒极了,于是我立刻去了京东下单预订了.目前是可以免息分期6个月就可以搞定了.‘ 大家敬请期待我的评测视频吧. ======== ...

  7. autofac生命周期入门(如何避免内存泄漏)

    如果你是一个IOC新手,那么生命周期可能会比较难以理解.以至于谈到这个问题时,一些老手也时常表示疑虑和害怕.一个令人不安的问题就是-对象没有在合适的时机被销毁.这样一来内存的使用率就会一直攀升,直到程 ...

  8. [No0000A5]批处理常用命令大全&&21个DOS常用命令

    1.Echo 命令打开回显或关闭请求回显功能,或显示消息.如果没有任何参数,echo 命令将显示当前回显设置.语法echo [{on|off}] [message]Sample: echo off e ...

  9. idea 乱码问题

    1. db browser查询结果为乱码: 找到idea的安装目录 如C:\..\Roaming\JetBrains\IntelliJ IDEA Community Edition 2018.1.3\ ...

  10. mo +离散化 HDU3333(听说还有离线线段树的做法 )

    http://acm.hdu.edu.cn/showproblem.php?pid=3333 mo套map会T,卡了一个logN,所以要先离散化处理 #define _CRT_SECURE_NO_WA ...