How To Iterate Through A List In Python

For a Python list or tuple object, we can go through it via a for loop, which we call iteration. In Python, iteration is done by for… in, whereas in many languages, such as C, iteration lists are done by subscripts, such as below Java code.

Python Higher Order Functions Example

In one word, if a function can accept another function as input parameter, such a function is called a higher order function. Python provide several higher order functions to simplify your coding, this article will introduce them with examples.

Python Slice Example

1. Slice List. Taking a partial element from a list or tuple is a very common operation. For example, how to take the first three elements from below list? >>> L = [‘Richard’, ‘Tom’, ‘Jerry’, ‘Jackie’, ‘Kevin’] You can take elements from above list like below. >>> [L[0], L[1], L[2]] [‘Richard’, ‘Tom’, ‘Jerry’] But when you …

Python Slice Example Read More »

Python Auto Send Mail Library Yagmail Example

Yagmail is a python library which can make sending email simple and easy. This article will show you examples about how to use yagmail to send emails to multiple receivers with multiple attachments, it also shows the difference between yagmail and general python sending email method.

Python Django Model Example

Model is generally used to represent database table data. It contains the basic fields and behaviors of the data you are storing. Django provides structured data processing and operation processing for your network applications through the abstract model layer (models). Database-related code is generally written in Django supports SQLite3, MySQL, PostgreSQL and other databases, …

Python Django Model Example Read More »

Python Access SQLite Database Example

SQLite is an embedded database which store all database data in a file. Because SQLite itself is written in C and small in size, it is often integrated into various applications, such as iOS and Android Apps. Python has built-in SQLite3 support, so you don’t need to install anything to use SQLite in Python.