How To Install And Use Python Virtualenv Module

For various reasons, we will need to install many versions of Python interpreter under the same operating system. We may also need different versions of same module for various reasons in one Python project. This causes a lot of confusion in Python environment management. Usually, different Python interpreters and dependency libraries are required for each …

How To Install And Use Python Virtualenv Module Read More »

Python Coroutines And Asynchronous IO Example

Usually in Python, we use multi-threading or multi-processing to implement concurrent programming. Computing-intensive tasks for cpu are usually implemented by multi-processor because of GIL, while io-intensive tasks can be scheduled by threads to allow threads to relinquish GIL while performing io tasks, thus achieving superficial concurrency.

How To Simply Use Swift Closures

1. The Definition Of Swift Closures. Closures are described in the Swift development documentation as functional independent modules that can be passed and referenced in your code. Closures in Swift are similar to blocks in C and Objective-C, as well as anonymous functions in other programming languages. Closures are primarily designed to capture and store …

How To Simply Use Swift Closures Read More »

How To Parse JSON Data In Python

The json library can parse JSON from strings or files. The library parses JSON format string and turns it into a Python dictionary or list. It can also convert Python dictionaries or lists to JSON string.

Four Methods For Merging Python 3 List

1. Use “+” Operator To Merge List Directly. >>> list_1 = [‘java’,’python’,’mysql’] >>> >>> list_2 = [100, 99, 101] >>> >>> print(list_1 + list_2) [‘java’, ‘python’, ‘mysql’, 100, 99, 101] >>> >>> print(list_2 + list_1) [100, 99, 101, ‘java’, ‘python’, ‘mysql’] >>> 2. Use List’s extend Method. The list’s extend method will extend current list …

Four Methods For Merging Python 3 List Read More »

Python Tricks For Beginners

This article list some python tricks you may use in python development. It is very useful for you to understand python coding.

How To Use Global Variable In Python Example

1. Variable Scope. Generally, variables defined outside of the function are called global variables, and variables defined inside the function are called local variables. Global variables are available in all scopes, and local variables are only available in it’s definition function. The order that different scope variables are called is local variable first, then global …

How To Use Global Variable In Python Example Read More »

How To Fix Python Importerror: No Module Named Setuptools

When i run my python code, i meet an import error. The error message is : ImportError: No module named setuptools. The reason for this error is because we do not install setuptools module, so to fix it, we just need to install setuptools module.