python

python

How to remove https from a url in python

Learn how to remove https from a url in python. We are discussing two different ways in this post. By using the replace() method and by using regex or regular expression.

Read
python

How to find the last occurrence of a character in a python string

How to find the last occurrence of a character in a python string. We will learn two different ways to do that by using rfind() and rindex() method.

Read
python

How to replace date and time of a python datetime object

Learn to replace date and time of a python datetime object. This example will show you how to replace year, month, day, hour, minute, second, microsecond and time zone of a datetime object in python.

Read
python

Python tutorial pretty print JSON to console and file

Learn how to pretty print JSON file in Python. Read JSON and pretty print and write JSON data as pretty print to file.

Read
python

Python program to find out the third largest number in a list

Python program to find out the third largest number in a list. The program will iterate through a list and find out the third largest number. The time complexity of this program is O(n).

Read
python

Python program to get random values from a list, dictionary, tuple or set

Python program to get random values from a list, dictionary, tuple or set with examples. We will learn how to find random elements by using the sample() method of random module.

Read
python

Different ways in python to remove vowels from a string

In this python program, we will learn how to remove all vowels from a string. Our program will take the string as input from the user and print out the modified string.

Read
python

write a python program to do a case insensitive string replacement

This python tutorial will show you how to do a case insensitive string replacement. We will create regex with ignore-case for the replacements.

Read
python

Python program to select an item randomly from a list

Learn how to select an item randomly from a list in python. We will learn how to select a random number and how to select a random string from a list of different values.

Read
python

Different ways to convert one boolean to string in python

Learn how to convert one boolean to string in python using different ways. In this post, I will show you three different methods by using format(), using %s and using str()

Read