Home » Python (page 4)


Python Collections : High Performing Containers For Complex Problems

1.Introduction Python is known for its powerful general purpose built-in data types like list, dict, tuple and set.  But Python also has collection objects like Java and C++.  These objects are developed on top of the general built-in containers with addtional functionalities which can be used in special scenarios. The objective of this article is to introduce python collection objects and explain ...

Read More »

Python Send Email Example

In this example, by using Python 3.4, we’ll learn how to send mails using Python’s smtplib module. SMTP stands for Simple Mail Transfer Protocol. It’s a protocol which handles sending e-mails and routing them between mail servers. To send a mail, we need the host and port of a server, then we send to this server the message with a ...

Read More »

Python Subprocess Example

In this article, using Python 3.4, we’ll learn about Python’s subprocess module, which provides a high-level interface to interact with external commands. This module is intended to be a replacement to the old os.system and such modules. It provides all of the functionality of the other modules and functions it replaces. The API is consistent for all uses, and operations ...

Read More »

Python Map Example

In this tutorial, by using python 3.4, we’ll talk about map functions. Strictly speaking, a map function, is a function that accepts a function and an array as arguments, and applies the given function to each element of the array, returning another array with the result of each transformation. So, in other words, a map applies a transformation to each ...

Read More »

Python Sockets Example

In this tutorial, we’ll talk about INET, STREAM sockets. We’ll talk about what sockets are, and learn how to work with blocking and non-blocking sockets. First things first, we’ll make a distinction between a “client” socket (endpoint of a conversation), and a “server” socket (switchboard operator). Your client (e.g. your browser) uses only client sockets, and your server uses both ...

Read More »

Python Dictionary Example

Dictionaries in Python are data structures that optimize element lookups by associating keys to values. You could say that dictionaries are arrays of (key, value) pairs. 1. Define Their syntax is pretty familiar to us, web developers, since its exactly the same as JSON’s. An object starts and ends in curly braces, each pair is separated by a comma, and ...

Read More »

Python Django Tutorial

Django is an open source web framework which solves most common problems of a web application development. It has some very useful features like an auto generated admin page and an ORM. It’s a high-level framework, so we just need to focus on the actual core logic of our business and let Django take care of mappings, filters and such. ...

Read More »

Python Logging Example

Logging is a process through which an application pushes strings to a handler. That string should be a line containing information about the piece of code from which it was sent and the context in that moment. It is a feature every application must have, and it’s as important as any other functionality you add to the application in question. ...

Read More »

How To Deadlock Your Python With getaddrinfo

What happens if you run this code? import os import socket import threading def lookup(): socket.getaddrinfo('python.org', 80) t = threading.Thread(target=lookup) t.start() if os.fork(): # Parent waits for child. os.wait() else: # Child hangs here. socket.getaddrinfo('mongodb.org', 80) On Linux, it completes in milliseconds. On Mac, it usually hangs. Why? Journey To The Center Of The Interpreter Anna Herlihy and I tackled ...

Read More »

Want to take your WEB dev skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • PHP Programming Cookbook
  • jQuery Programming Cookbook
  • Bootstrap Programming Cookbook
  • Building WEB Apps with Node.js
  • CSS Programming Cookbook
  • HTML5 Programming Cookbook
  • AngularJS Programming Cookbook