12 Apr 2022 Xavier Rigoulet How to Write “Greater Than or Equal To” in Python Comparison operators are an important part of Python programming. In this article, let’s explore how to use the greater than or equal to comparison in Python. Many programming beginners wonder how to write “greater than or equal to” in Python. Well, to write greater than or equal to in Python, you need to use the >= comparison operator. It will return a Boolean value – either True or False. Read more 31 Mar 2022 Xavier Rigoulet How to Sort a List Alphabetically in Python What if you have a list of strings (text items) and you need to sort them alphabetically? In this article, we’ll show you how to sort a list in Python. A sorting algorithm puts elements of a list into a particular order. They help reduce the complexity of a problem and can even optimize other algorithms. Because of its complexity, sorting is one of the most important problems in computer science. Read more 24 Mar 2022 Xavier Rigoulet A Guide to the Python argparse Module Want to write more professional, cleaner-looking code? Use the Python argparse module. This article will show you how to build a command line interface in Python with argparse. In Python, argparse is one of those modules that can help you write more professional and better-looking Python code. This is because argparse makes it easy to write user-friendly command-line interfaces. By the end of this article, you will have acquired a solid knowledge of the argparse module – you can even use the article as your Python argparse cheat sheet. Read more 8 Mar 2022 Xavier Rigoulet How to Use virtualenv in Python Have you tried to install a Python package for a new project, just to see your other projects break because of some compatibility issues? You can avoid this with the help of virtualenv in Python. virtualenv is a tool that allows you to create virtual environments in Python and manage Python packages. It helps you avoid installing packages globally; global installations can result in breaking some system tools or other packages. Read more 15 Feb 2022 Xavier Rigoulet Working With iCalendar in Python In my previous article on How to Work With the Calendar and Arrow Python Modules, we explored how to use calendars in Python. But what about iCal files? In this article, we will discuss how to work with iCalendar in Python, write and read iCal files, and parse a calendar from a URL like Google Calendar. But first, what is an iCal file? The iCalendar (Internet Calendaring and Scheduling Core Object Specification) format allows users to store and exchange calendaring and scheduling information such as events and to-dos. Read more 20 Jan 2022 Xavier Rigoulet Your Guide to pyenv This is your guide to pyenv for changing and switching between Python versions. pyenv lets you switch between Python versions. Running multiple Python versions can be a challenge; pyenv makes it easier to change versions of Python. It's simple and discreet, and it follows the UNIX tradition of the single-purpose tool that does one thing well. It's useful for developers who need access to different versions of the language and those who want to use the latest version of Python without upgrading their entire system. Read more 13 Jan 2022 Xavier Rigoulet The Python Requirements File and How to Create it Python requirements files are a great way to keep track of the Python modules. It is a simple text file that saves a list of the modules and packages required by your project. By creating a Python requirements.txt file, you save yourself the hassle of having to track down and install all of the required modules manually. In this article, we will learn how to create Python requirements files along with the best practices and the benefits of using them. Read more 23 Dec 2021 Xavier Rigoulet How to Download a File in Python Did you know you can download a file programmatically in Python? I will show you how to fetch and save a file in Python. This process is known as web scraping and is an essential step of any data-related project. Web scraping is the process of collecting data from a website. While it can be done manually by a user, it usually refers to an automated method of data collection with the help of a web crawler. Read more 16 Nov 2021 Xavier Rigoulet How to Write Custom Sort Functions in Python In computer science, a sorting algorithm puts elements of a list into a particular order. They are important because they often reduce the complexity of a problem. Let’s discover how to use custom sort functions to implement custom orders and comparisons in Python. In my previous article on working with streams in Python, I briefly introduced sorting methods with list.sort() and sorted(). Both list.sort() and sorted() have a key parameter that specifies a function to be called on each list element before making comparisons. Read more 9 Nov 2021 Xavier Rigoulet Map, Filter, Reduce – Working on Streams in Python Do you know how to work with Python streams like Java streams? A stream is a sequence of elements. With map(), filter(), and reduce() – the three cornerstone functions of functional programming – you can operate over a sequence of elements. In this article, we will learn how to work with streams in Python like we work with them in Java. But first, let’s say a word about functional programming. Read more «« « 1 2 3 4 » »»