String Methods
isprintable()
Check whether all characters can be printed, apart from the empty string which also passes.
str.isprintable()
Check whether all characters can be printed, apart from the empty string which also passes.
Result
Returns
True if every character is printable or the string is empty; otherwise False.
Run it
Try it
Run it and change it
text = "Hello\n" print(text.isprintable())
Output
Press Run to see what it prints.