str.isprintable() Printable
Last updated: 2026-09-22
str.isprintable() Printable
str.isprintable() returns True if non-empty and every char is printable.
| Category | String Methods |
|---|---|
| Kind | Built-in Type Method |
| Python Version | all |
📝 Syntax
str.isprintable()
Returns:bool. True if non-empty and every char is printable.
Mutates the original:No (returns a new object)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
True
False
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhat does an empty string return?
ATrue, an empty string is considered printable. This is what distinguishes it from other is* methods that require non-empty input.
QWhich characters are not printable?
AControl characters are not printable: '\n'.isprintable() and '\t'.isprintable() are both False.
QWhat is it used for?
AChecking whether text is suitable for direct display, e.g. filtering output that contains control characters.