Python String lower() Method

Python String lower() method converts a string object into a lower case string. This is one of the builtin string functions in Python. Since strings are immutable in Python, this method only returns a copy of the original string. Syntax and Usage of Python String lower() Method Format: Here, str_copy is the lowercase string of …

Python String lower() Method Read More »

Copy a File in Python

In our previous tutorials, we learned some Python file operations like reading, writing and deleting. Let’s learn to copy a file in Python in this tutorial. We can copy a file in Python using different methods under the below-mentioned modules, shutil module os module subprocess module In this tutorial, we are going to learn using …

Copy a File in Python Read More »

How To Delete Files in Python

Introduction In our Python file handling Tutorial, we learned how to manipulate files from within Python. In this tutorial, we’ll learn how to delete files in Python. We know how to read from and write to a file in Python. Let’s learn the delete operation in Python today. Suppose after successfully creating a file, we …

How To Delete Files in Python Read More »

Python Write File

We have previously seen how we can read from a file in Python. Similarly writing to a file can also be achieved in Python programming. But, before we start writing to a file, we must ensure that the mode in which the file has been open allows it. Let us take a look using which …

Python Write File Read More »

Python Set Difference

Python Set Difference basically performs the difference operation on iterable objects and the result contains the difference between them. It contains elements that are present in the set (on which the operation is invoked) which are not present in the other sets. Python Set Difference Venn Diagram The below Venn diagram provides a much better …

Python Set Difference Read More »

Python Print Without Newline

There are different ways through which we can print to the console without a newline. Let’s quickly go through some of these methods. 1. Using print() We can use the print() function to achieve this, by setting the end (ending character) keyword argument appropriately. By default, this is a newline character (\n). So, we must …

Python Print Without Newline Read More »

Find String Length in Python

We can find string length in Python using the built-in len() function. Let’s look at how this function works, and also let’s try finding the length of various types of Python strings using len(). Using len() Let’s look at some simple examples to illustrate len(). This prints 20 because it is the number of characters …

Find String Length in Python Read More »