Python Package Version: the __version__ Attribute

Python __version__ Attribute Python contains many “Magic Methods/Attributes”. One of these is __version__ commonly called “Dunder version” because of the double underscore before and after version. In this article, I will briefly look at what a Dunder Method/Attribute is and talk about __version__. What Does a Dunder Method/Attribute Do? Dunder Methods/Attributes, also called “Magic Methods” … Read more

How to Convert Avro to CSV in Python?

💬 Question: How to convert an .avro file to a .csv file in Python? Solution: To convert an Avro file my_file.avro to a CSV file my_file.csv, create a CSV writer using the csv module and iterate over all rows using the iterator returned by fastavro.reader(). Then write each row to a file using the writerow() … Read more

Top 10 Python Packages for Crypto

As you know, Web3 is a new online era that differs from Web2 in its foundational technology, the blockchain.  Blockchain is a disruptive technology characterized by being a decentralized solution for communication and transactions. Decentralization means that there are no controlled databases by third-party service providers. These providers can own and hold your accounts or … Read more

Python RegEx – Match Whitespace But Not Newline

Problem Formulation 💬 Challenge: How to design a regular expression pattern that matches whitespace characters such as the empty space ‘ ‘ and the tabular character ‘\t’, but not the newline character ‘\n’? An example of this would be to replace all whitespaces (except newlines) between a space-delimited file with commas to obtain a CSV. … Read more

Python One Line Pattern

Problem Formulation You appear at an interview, and the interviewer intends to test your skills in writing concise one-line solutions. So he decides to present you with a long and complex-looking piece of code that is seemingly intimidating and asks you to come up with one-line solutions for the given code. Given: Challenges: Guess the … Read more

How to Repeat a String Multiple Times in Python

Problem Formulation and Solution Overview In this article, you’ll learn how to repeat a string multiple times in Python. Over your career as a Python coder, you will encounter situations when a string needs to be output/displayed a specified number of times. The examples below offer you various ways to accomplish this task. 💬 Question: … Read more

NumPy Datetime: How to Work with Dates and Times in Python?

Dates and times have come a long way since the hourglass was invented

In this article, we’ll be learning about something that is literally everywhere. Whatever corner you turn, whatever street you run down, you can’t get away from it. It is as ubiquitous as the physical space around us. Yes today, we’re talking about… TIME. More specifically, we’re talking about NumPy’s functions that represent dates and times. … Read more