Skip to main content

Writing an Excel File in Python

In our previous Python tutorial, you have learned how to Reading an Excel File in Python. In this tutorial, you will learn how to Write an Excel File in Python.

The Excel spreadsheet is a popular file type that lets to create, view, edit, and share your files with others quickly and easily.

In this tutorial, we will use Openpyxl module from Python to wrting to an Excel file with extension such as (xlsx/xlsm/xltx/xltm). The Openpyxl module allows to read and write Excel files. (more…)

Read and Write JSON to File in Python

In our previous Python tutorial, you have learned how to convert string data into JSON in Python. In this tutorial, you will learn how to Read and Write JSON data to a File in Python.

JSON (JavaScript Object Notation) data is an easy-to-read, flexible text-based format that can save and communicate information to other apps. Python has build-in JSON module that accept a JSON string and convert into a dictionary.

Pyhton has open() method to open file and return its object. So let’s proceed to write json data to a file and read json data from a file. (more…)

Convert String To Bytes in Python

In our previous Python tutorial, you have learned how to convert string into array in Python. In this tutorial, you will learn how to convert String to Bytes using Python.

The conversion of strings to Bytes is very common due to a lot of file handling and Machine learning methods require you to convert them. The strings are human-readable and in order to become them machine-readable, they must be converted to byte objects. This conversion also enables the data to be directly stored on the disk.

Python has a build-in method bytes() and encode() to convert string into bytes. So here in this tutorial, you will learn how to use these methods to convert string to bytes. (more…)

Convert String To Array in Python

In our previous Python tutorial, you have learned how to convert string into Bytes in Python. In this tutorial, You will learn how to convert string to an array in Python.

String is the most used data type in any programming language. You can convert Strings into different data such as Bytes, JSON, Array, list etc. So here int this tutorial, we will expalin how to convert String into array using Python.

As in Python, Array is represented by List and we can assume list as an array. So, basicaly we will work on the list to convert string into list. Python has built-in split() and list() method to convert string into array or list. (more…)