4 Ways to fix SSL: CERTIFICATE_VERIFY_FAILED in Python

SSL certificate_verify_failed errors typically occur as a result of outdated Python default certificates or invalid root certificates. We will cover how to fix this issue in 4 ways in this article. Error info about CERTIFICATE_VERIFY_FAILED <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>   Create unverified context in SSL import ssl context = ssl._create_unverified_context() urllib.request.urlopen(req,context=context) […]

3 Examples to Fix InsecureRequestWarning in Python

These InsecureRequestWarning warning messages show up when a request is made to an HTTPS URL without certificate verification enabled. we will cover how to fix InsecureRequestWarning with 3 examples in this article. We will skip the SSL certificate check in the first and second examples. For the third example, we will add the CA bundle […]

5 Useful Python 3 Range Function Examples

Python range() is a built-in function available with Python from Python(3.x), and it gives a sequence of numbers based on the start and stop index given. In case the start index is not given, the index is considered as 0, and it will increment the value till the stop index. Python 3 Range Syntax range(start, […]

3 Practical Python 3 For Loop Examples

A Python for loop is a set of instructions that is repeated, or iterated, for every value in a sequence. Sometimes for-loops are referred to as definite loops because they have a predefined beginning and end as bounded by the sequence. Python For loop Syntax The general syntax of a for-loop block is as follows. […]

3 Ways to Check Python Version in Linux

In this article, we will cover how to check the Python version in 3 ways.   Check Python Version Commands Example Output python –version or python -V or python -VV Python 3.6.8 import sys sys.version 3.6.8 (default,  Mar 18 2021,  08:58:41) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] import sys sys.version_info sys. version_info (major= 3,  minor=6, […]

3 Ways to check Python 3 Version

In this article, we will cover how to check the python version in 3 ways. 3 Ways to check Python Version Commands Example Output python3 –version or python3 -V or python3 -VV Python 3.7.2 import sys sys.version 3.7.2 (tags/v3.7.2: 9a3ffc0492, Dec 23 2018, 23:09:28)[MSC v.1916 64 bit (AMD64)]’ sys.version_info sys.version_ info (major= 3, minor= 7, […]

3 Examples to Split String into List in Python 3

The split() method in Python splits strings into a list. It will return a list of the words in the string/line, separated by the delimiter string. python 3 string split Syntax string.split(separator, max) Parameter Description separator The is a delimiter. The string splits at this specified separator. If is not provided then any white space […]

10 Useful Python 3 List Methods Examples

Python 3 has a number of built-in data structures, including lists. Data structures provide us with a way to organize and store data, and we can use built-in methods to retrieve or manipulate that data. It is important to keep in mind that lists are mutable — or changeable — data types. Unlike strings, which […]

6 Python 3 String Split Method Examples

The split() method separates a string into parts wherever it finds a space and stores all the parts of the string in a list. The split method returns a list of all the words of the string separated by a delimiter and the num integer specifies the maximum splits. If num is not specified, then […]

3 Ways to Check if List is Empty in Python

In this article, we will cover 3 ways to check if the list is empty in Python. To check if Python List is empty, we can write a condition if the length of the list is zero or not; or we can directly use the list reference along with not operator as a condition in […]