Home » Python


Python Iterate over dictionaries Example

1. Introduction In programming, to iterate means to go over the items in an element. And when you iterate, you visit the various items in the element performing a specified action. Consider you have a bag of balls and you want to iterate over the balls, you visit each ball in the bag and perform a specified action. That is ...

Read More »

Python String split() Example

1. Introduction Manipulating strings can be a very important aspect of programming due to the various number of ways in which strings can be manipulated. And one such way of manipulating strings is by splitting them based on several characters. You might want to split strings based on commas, semicolons and so much more. In our article for today, we ...

Read More »

Python Trim String Example

1. Introduction White spaces are good to have, but sometimes they appear where they are not needed. White spaces are basically what allows us to have one word from another. But no matter how good they sound, sometimes we do not want them appearing at the end of words that have no words after them. So during those times, we ...

Read More »

Python strptime() Example

1. Introduction Consider the case when you have a string containing date information and you would need to extract the date information like the day, month, year, and so many other information. Imagine a string like “30-10-2019” and you realize that the first part is the day, followed by the month, then the year. Here is where the strptime() method ...

Read More »

Python String to Int Example

1. Introduction For me there is something beautiful about code. I like to think of it as “Digital Alchemy”. A very wise programmer once told me that the the “code never lies”. Oh how true that is. Coding can be brutal, humbling and it can also be incredibly rewarding. We all have our favourite programming languages. For whatever different reasons. ...

Read More »

Python String Append Example

1. Introduction This is an article about appending of string in python. In Python, string is an immutable object. You can use ‘+’ operator to append two strings to create a new string. There are various ways such as using join, format, stringIO and appending the strings with space. 2. Python String Appending In this section, we look at multiple ways of ...

Read More »