Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
communitycreator

What is isprintable() in Python?

Mahnoor Zaheer

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

isprintable() is a string method in Python that tells whether something is printable or not.

Printable characters include letters, numbers, symbols, punctuation, and whitespace.

Syntax

string.isprintable()
The syntax of isprintable() method in Python

Parameters

The isprintable() method does not take any parameters.

Return value

It returns a Boolean character, True or False, depending on whether the string is printable or not.

Code

In the code below, the isprintable() method returns False for ASCII characters because they are not printable. It returns True for the printable character string.

string = chr(28) + chr(97)
print(string.isprintable()) ## returns False
string = 'abced = 4'
print(string.isprintable()) ## returns True
The syntax of isprintable() method in Python

RELATED TAGS

python
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring