## 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 find unique occurrences in a Python list?

Problem To get only the unique values in a Python list. Solution In this post, we’ll introduce three different techniques to identify if we have any repeated values in the list and obtain a list of unique values. Option 1: Using NumPy NumPy is a Python library that can be used to work with arrays. … 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

## Convert a list of strings to float numbers in Python?

Problem: We would like to change the data type of all elements in a Python list from string to floating. Solution: We have three methods to convert a list of strings to float using Python programming. Let us proceed to look at the code and the output for each method. Use Python for loops Using … Read more