How to convert boolean to string in Python


To convert boolean values to strings in Python, you need to use the str() function.

The str() function is used to convert Python objects of any type to strings. This function can be used on boolean values as follows:

>>> str(True)
'True'
>>> str(False)
'False'

You only need to pass the boolean value you want to convert as an argument to the str() function, and you’re done!

If you need to convert string values back to boolean, you can read this tutorial.

I hope this tutorial is helpful. See you in other tutorials! 👍

Get 100 Python Snippets Book for FREE 🔥

100 Python snippets that you can use in various scenarios

Save 1000+ hours of research and 10x your productivity