Posts by Saruque Ahamed Mollick

How to take only a single character as an input in Python

By Saruque Ahamed Mollick

In this tutorial, we will learn how to take only a single character as an input in Python with some cool and easy examples. In many situations, you might have to come up with this.... Read More

How does carriage return “\r” work in python

By Saruque Ahamed Mollick

In this Python tutorial, we will learn how does carriage return “\r” work in Python. A carriage return is a special type of escaping character. Many of the Python learn.... Read More

How to delete a file in Python with examples

By Saruque Ahamed Mollick

In order to delete a file in Python, you have to import the os module. In this tutorial, you will learn how to delete a file in Python with some easy examples. The function we are.... Read More

How to read a specific line from a text file in Python

By Saruque Ahamed Mollick

To read a specific line from a text file in Python you can use readlines() or you can also import linecache. Here we gonna learn reading a specific line from a text file in Python.... Read More

How to count the number of lines in a text file in Python

By Saruque Ahamed Mollick

In order to know how to count the number of lines in a text file in Python, you have to know open() function in Python. In this tutorial, we will learn to count the number of lin.... Read More

How to create a text file in Python

By Saruque Ahamed Mollick

To create a text file in Python you will need to work with file object of Python. To create a text file and to add some text in it we will need to use two inbuilt functions of Pyt.... Read More

How to generate random number in Python

By Saruque Ahamed Mollick

Python has its own module to generate a random number. The module is the random module. By using this special module you can easily generate random number in Python. But the rand.... Read More

How to detect strings that contain only whitespaces in Python

By Saruque Ahamed Mollick

To check if a string is containing only white spaces or not you can use isspace() method in Python. This tutorial is to show you how to detect strings that contain only whitespace.... Read More