Skip to content

Blog

[Python] Displaying Progress Bars Using the tqdm Package and Attempting to Implement Your Own Progress Bar

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.

Read More »[Python] Displaying Progress Bars Using the tqdm Package and Attempting to Implement Your Own Progress Bar

Using "json" module to write and load Json file in Python

python
Display Python code on the screen

Introduction

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.

Read More »Using "json" module to write and load Json file in Python

Display the computer's OS and CPU core in Python

python
Display Python code on the screen

Introduction

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.

Read More »Display the computer's OS and CPU core in Python

[Python] Use enumerate() function to output index and element at the same time

python
Display Python code on the screen

Introduction

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).

Let's take a look at a simple sample code.

Read More »[Python] Use enumerate() function to output index and element at the same time

[Python] Using package pytube to download YouTube videos


Introduction

Various electronic entertainments of modern people are inseparable from YouTube, whether it is to follow dramas, query tutorial, watch funny videos ... we will watch it on YouTube platform. Saying watching YouTube is the most important thing for modern people.

Sometimes, we will need to download videos from YouTube. Of course, this matter itself is likely to violate intellectual property rights, so our use is limited to teaching and non-commercial use. The downloaded video must be deleted within a certain period of time.

Read More »[Python] Using package pytube to download YouTube videos

Use Python pacakge Pillow to convert font files to PNG images

python
Python is the most popular programming language!

Introduction

Today, I need to plot font files in PNG format and save it, which sounds like a rare requirement. After browsing on the Internet, I found that it can use ImageFont module of Python package Pillow to solved.

At the beginning, I wanted to use the Python package fontTools to solve the problem, but later I found that the Imagefont module in Pillow was better.

Read More »Use Python pacakge Pillow to convert font files to PNG images