Python String Methods Isprintable()

The isprintable() method will return True if all the characters are printable, else False. Syntax: string.isprintable()

Example is printable: This is some printable text or characters

1
2
3
some_text = "I am definitely printable @#$%^&"
print("Is this printable: ")
print(some_text.isprintable())

Example of none printable character in Python will be the ones with a carriage return or a line feed.

1
2
3
some_non_printable_text = "\n I am definitely not printable"
print("Is this printable: ")
print(some_non_printable_text.isprintable())

Related Posts

0 Comments

12345

    00