Python String isprintable() Method

Example

Check if all characters in the text are printable:

txt = "Hello! Are you #1?"
x = txt.isprintable()
print(x)

Run Instance

Definition and Usage

If all characters are printable, the isprintable() method returns True, otherwise it returns False.

Non-printable characters can be carriage return and newline characters.

Syntax

string.isprintable()

Parameter value

No parameters.

More Examples

Example

Check if all characters in the text are printable:

txt = "Hello!\nAre you #1?"
x = txt.isprintable()
print(x)

Run Instance