Menu Close

Python String isprintable() Method

python string isprintable

In this article, you will learn about the Python string isprintable() method along with some examples. isprintable function in Python is the best for checking a string contains printable characters or not.

In the previous tutorial, we have seen the Python string isnumeric() method to check whether a string contains numeric or not.

Python String isprintable() Method:

Python string isprintable() method is a string built-in method that is used to return True if all the characters are printable otherwise return False.

Syntax:

The syntax of isprintable function in python is:-

string.isprintable()

Parameter:

The isprintable() method does not support any parameter.

Return Type:

isprintable function in Python returns True or False.

Python string isprintable example:

Here we will take some example to understand python string isprintable method.

Example 1:

str = "Hello, Programming Funda"
str2 = str.isprintable()
print(str2)

Output will be:- True

Example 2:

str = "\tprogramming"
str2 = str.isprintable()
print(str2)

Output will be:- False

Example 3:

str = "Python programming\n"
str2 = str.isprintable()
print(str2)

Output will be:- False

Example 4:

str = "Python programming 12345"
str2 = str.isprintable()
print(str2)

Output will be:- True

Conclusion

In this tutorial, you have learned the Python string isprintable() method. String isprintable function is the best to function to check whether a string is printable or not.

I hope this tutorial will help you. If you like this article, please share it with your friends who want to learn Python programming.

For More Information:- Click Here

Previous Article
Next Article

Related Posts

Leave a Reply