Advertisement
# Signature of isprintable() method
isprintable()
# Python - Method isprintable() Example
# Creating the first string of printable values
s1 = ('Name')
# Printing the first string
print('Value of first string : ', s1)
# Calling the upper() method on first string
print('Calling the isprintable() method on first string : ', s1.isprintable())
# Creating the second string of printable values
s2 = ('Cost of 2 Apple')
# Printing the second string
print('Value of second string : ', s2)
# Calling the isprintable() method on second string
print('Calling the isprintable() method on second string : ', s2.isprintable())
# Creating the third string of printable values
s3 = ('Can-you-print-this?')
# Printing the third string
print('Value of third string : ', s3)
# Calling the isprintable() method on third string
print('Calling the isprintable() method on third string : ', s3.isprintable())
# Creating the fourth string of printable values
s3 = '(!@#$%^&**()'
# Printing the fourth string
print('Value of fourth string : ', s3)
# Calling the isprintable() method on fourth string
print('Calling the isprintable() method on fourth string : ', s3.isprintable())
Value of first string : Name
Calling the isprintable() method on first string : True
Value of second string : Cost of 2 Apple
Calling the isprintable() method on second string : True
Value of third string : Can-you-print-this?
Calling the isprintable() method on third string : True
Value of fourth string : (!@#$%^&**()
Calling the isprintable() method on fourth string : True
Advertisement
# Python - Method isprintable() Example
# Creating the first string of printable values
s1 = ('Lion King\n')
# Printing the first string
print('Value of first string : ', s1)
# Calling the upper() method on first string
print('Calling the isprintable() method on first string : ', s1.isprintable())
# Creating the second string of printable values
s2 = ('Shawshank Redemption \n Forrest Gump')
# Printing the second string
print('Value of second string : ', s2)
# Calling the isprintable() method on second string
print('Calling the isprintable() method on second string : ', s2.isprintable())
# Creating the third string of printable values
s3 = (' Avengers \t Endgame')
# Printing the third string
print('Value of third string : ', s3)
# Calling the isprintable() method on third string
print('Calling the isprintable() method on third string : ', s3.isprintable())
Value of first string : Lion King
Calling the isprintable() method on first string : False
Value of second string : Shawshank Redemption
Forrest Gump
Calling the isprintable() method on second string : False
Value of third string : Avengers Endgame
Calling the isprintable() method on third string : False
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement