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.

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 »

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 »