Best Solidity Linter

πŸ’‘ A code linter is a static code analysis tool to find programming errors, bugs, style mistakes, and suspicious constructs. The best Solidity Linter is Ethlint with a close second Solhint. Most other linters are not well qualified to compete with those early tools! Solidity Linter #1 – Ethlint Ethlint comes with the popular slogan … Read more

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 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

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

How to Convert Space-Delimited File to CSV in Python?

The easiest way to convert a space-delimited file to a comma-separated values (CSV) file is to use the following three lines of code: import pandas as pd df = pd.read_csv(‘my_file.txt’, sep=’\s+’, header=None) df.to_csv(‘my_file.csv’, header=None) We’ll explain this and other approaches in more detail next—scroll down to Method 3 for this exact method. Problem Formulation Given … Read more