This is a record of the error message that I have encountered: When learning a sample code provided on the Internet, it was no problem for them to use the code to cut the picture and save it in the clipboard, but when I used their sample, it show the following error message:
ModuleNotFoundError: No module named 'cStringIO'
It looks like I lacked the cStringIO module, and finally I found the answer on StackOverflow.
When we write Python code, sometimes we want to visualize the 'progress bar' to help us understand where our program is currently executing. For this need, instead of writing the progress bar ourselves, we can consider using a well-known progress bar module in Python—tqdm.
Json format file is very easily to process, and many programming language support it. So this data format is quite suitable for joint access to a data and development between different programming languages.
Today I want to introduce how to use the Python package "json" to write and load a Json format file.
When we developing a Python project, sometimes we need to check which OS is user's current operating system, because of different operating systems we may have to use different methods to implement the same function.
In my recent project, I also need to know how many CPU cores the user has to implement a multi-threaded program, so, by the way, it is recorded here.
simply put, the platform module can be used to test the user operating system, and the cpu_count() function in multiprocessing module can be used to calculate the number of CPU cores.
enumerate() is a function often used in Python. Its usage is very simple, just only need use enumerate(iterable, start_index). The first parameter enters the iterable object, and the second parameter enters the first number to be counted (Calculate from 0 by default).