Check If Directory Exist In Python

Python provides different methods and ways in order to check if a directory exists. Generally, the os.path module is used to check the specified directory if it exists. In this tutorial, we examine all Python methods to check directory existence. Check If Directory Exists with os.path.exists() Method Python provides os.path for different operating-related methods. The … Read more

Python Order List (Ascending and Descending)

Python Order List (Ascending and Descending)

Python list is used to store multiple elements in a single variable. These items can be in different types like string, integer, etc. Sometimes we may want to sort them accordingly. We can sort them in ascending or descending ways by using the sort() provided by the list type. Order String List Ascending By default, … Read more

How To Convert Python Dictionary to JSON?

How To Convert Python Dictionary to JSON?

JSON is a very popular data structure used to store information in a human-readable and simple format. The long form for the JSON is the JavaScript Object Notation. The JSON format is generally used to store and transfer data between different systems and applications. As a popular programming language Python supports JSON. The Python Dictionary … Read more

Sorted Reverse In Python

Python provides the sorted() function in order to build a new list from provided iterable. We can sort provided iterable in reverse too. The iterable can be a list, string, tuple, or dictionary. In this tutorial we examine different examples of the reverse sort for the string, list, tuple, dictionary event nested list. sorted() Syntax … Read more

“TypeError: ‘str’ object is not callable” Error Solution

Python provides different types like string. The str() function is used to convert provided types like integer, float, etc into the string type. If the str is also used as a variable or object name and we try to call the str() function we may get the “TypeError: ‘str’ object is not callable” error like … Read more

Python sum() Function Tutorial

Python sum() Function Tutorial

Python provides the sum() function in order to sum multiple items or multiple variables or list items in an easy way. The sum() function is very similar to the Microsoft Excel SUM() macro. In this tutorial, we examine how to sum up these different scenarios. sum() Function Syntax The sum() function syntax is like below … Read more