I Used This Python Script to Rename All Files in Subfolders (Recursive)

I’m currently working on a website project for the Finxter ecosystem, where I’m given a folder with subfolders (and subfolders within) that contain image files. Example folder structure: folder — subfolder1 —- image1.jpg —- image2.jpg —- image3.jpg — subfolder2 —-image1.jpg —-image2.jpg Across the subfolders, the files may have the same name, which causes an issue … Read more

How to Write a Hex String as Binary Data & Binary File in Python?

Hex String as Binary Data To convert a hex string such as ‘FF0001AF’ to binary data, use the binascii.unhexlify(hex_str) function that returns the binary data represented by the hexadecimal string. Note that this converts two hex string digits to one byte, i.e., hex string ‘F0’ is converted to the byte representation 11110000, or in binary … Read more

How to Read the First Line of a File in Python

Problem Formulation and Solution Overview This article will show you how to read and display the first line of a file in Python. For this article, we will work with a flat-text file containing five (5) possible things to do during your lifetime. This file is saved to bucket_list.txt and placed into the current working … Read more