Python str.isprintable()
检查字符是否是可打印输出的# Python code for implementation of isprintable()
# checking for printable characters
string = 'My name is Ayush'
print(string.isprintable())
# checking if \n is a printable character
string = 'My name is \n Ayush'
print(string.isprintable())
# checking if space is a printable character
string = ''
print( string.isprintable())
结果
True
False
True
页:
[1]