How to Read and Convert a Binary File to CSV in Python?

To read a binary file, use the open(‘rb’) function within a context manager (with keyword) and read its content into a string variable using f.readlines(). You can then convert the string to a CSV using various approaches such as the csv module. Here’s an example to read the binary file ‘my_file.man’ into your Python script: … Read more

How to Convert Epoch Time to Date Time in Python

Problem Formulation and Solution Overview In this article, you’ll learn how to convert Epoch Time to a Date Time representation using Python. On January 1st, 1970, Epoch Time, aka Time 0 for UNIX systems, started as a date in history to remember. This date is relevant, not only due to this event but because it … Read more

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

Blockchain Basics of Smart Contracts and Solidity

This article will give you an overview of the blockchain basics, transactions, and blocks. In the previous article of this series, we looked at how to create your own token using Solidity and, specifically, events for transactions. Blockchain Basics Blockchain technology enables us to write programs without having to think about the details of the … Read more

How to Convert a Text File to a CSV File in Python?

You can convert a text file to a CSV file in Python in four simple steps: (1) Install the Pandas library, (2) import the Pandas library, (3) read the CSV file as DataFrame, and (4) write the DataFrame to the file: (Optional in shell) pip install pandas import pandas as pd df = pd.read_csv(‘my_file.txt’) df.to_csv(‘my_file.csv’, … 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