Python 字符串方法
檢查文本中的所有字符是否可打印:
txt = "Hello! Are you #1?" x = txt.isprintable() print(x)
運行實例
如果所有字符都是可打印的,則 isprintable() 方法返回 True,否則返回 False。
不可打印的字符可以是回車和換行符。
string.isprintable()
無參數.
txt = "Hello!\nAre you #1?" x = txt.isprintable() print(x)