Home » Python

Python

Python Try and Except Example

Today we will talk about one of the most important things in Python – exception handling. Firstly, let’s start with the definition of exceptions. They are errors detected while the program is being executed. So for example, if you write the program and you think it’s alright and try running it, it may give you some errors. 1. Basic exceptions ...

Read More »

Python Datetime Tutorial

Today we will learn how to work with dates and time. It’s an essential skill because in almost every Python program you work with time one way or another. It can be really confusing at first how to work with them because we have dates, time, timezones, timedeltas. Table Of Contents 1. Introduction about datetime module 2. Examples 2.1. Basic ...

Read More »

Python Regular Expression Tutorial

One of the most daunting tools at the beginning, but quite powerful if you master it, is regular expressions. They seem scary and hard to understand, but once you get used to them, you realize how powerful they are. So in this article, I will try to guide you through them, so they won’t seem complicated to you, especially if ...

Read More »

Python Class Inheritance Example

Today we will be talking about OOP method of programming. The particular area of our interest would be Inheritance. Before we go any further, let’s talk about basic principles of programming. We know that there is an imperative method (when we use for and while loops), functional (when we operate with functions) or Object Oriented Programming (where we write code ...

Read More »

Using the New Python Instance Properties

Last week, I showed you my new implementation for instance-level properties in Python. This week, we’ll take another look at it by implementing a few Delegated Properties and helpers to make using them just a hair nicer. Recreating Kotlin’s Built-In Delegates For inspiration of what Delegated Properties to create, we’ll start by recreating the ones built into Kotlin, starting with ...

Read More »

Another Look at Instance-Level Properties in Python

A while back, I did a post on making instance-level properties in Python where the implementation of it required inheritance as well as messing with __getattribute__() and __setattr__(), which are a little dangerous to mess with. Then I had another idea last night (as of the time of writing this): Use normal descriptors to delegate to “Delegated Properties” (name taken ...

Read More »

Leaflet: Mapping Strava runs/polylines on Open Street Map

I’m a big Strava user and spent a bit of time last weekend playing around with their API to work out how to map all my runs. Strava API and polylines This is a two step process: Call the /athlete/activities/ endpoint to get a list of all my activities For each of those activities call /activities/[activityId] endpoint to get more ...

Read More »

Python: Flask – Generating a static HTML page

Whenever I need to quickly spin up a web application Python’s Flask library is my go to tool but I recently found myself wanting to generate a static HTML to upload to S3 and wondered if I could use it for that as well. It’s actually not too tricky. If we’re in the scope of the app context then we ...

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