How to write text files in Python 3?

Task: A very common automation task that we tackle with Python is to create text files as well as read, write and save data into those files. Solution: Python delivers very powerful built-in functions to create and manipulate text files. In this short tutorial we’ll go through several key capabilities: Create a new text file … Read more

How to convert a Python string to Hex format?

Problem To convert a string data type to an Hexadecimal number format in Python 3.X. Solution We have two methods to convert a python string to a Hex value. Using int() function and by importing literal_eval from the ast Python module. In this post, we will learn how we can convert a string to a Hexadecimal number.  … Read more

How to round up a float number in Python?

Problem: Today, we’ll learn how to round up float numbers using Python. Solution: We have two methods to handle the rounding float numbers in Python. Using the round() function and Decimal module. We will look at the solutions with examples for each method in this post. Option 1: Python Round Function Python has an inbuilt function round(), which … Read more