In this tutorial, you will learn 5 ways in Python to list all files in a specific directory. Methods include os.listdir(), os.walk(), the glob module and more.
__name__ is a special variable in Python. “If __name__== ‘__main__’” is a conditional statement that tells the Python interpreter under what conditions the main method should be executed.
Pythonic describes code that doesn’t just get the syntax right but uses the language in the way it’s intended to be used. Here’s how to optimize your Python code.
Bubble sort is a sorting algorithm that uses comparison methods to sort an array. It has an average time complexity of O(n^2). Here’s what you need to know.