Why does Python's string.printable contains unprintable characters?

前端 未结 2 1862
我寻月下人不归
我寻月下人不归 2021-02-19 20:51

I have two String.printable mysteries in the one question.

First, in Python 2.6:

>>> string.printable
\'0123456789abcdefghijklmnopqrstuvwxyzABCD         


        
2条回答
  •  不要未来只要你来
    2021-02-19 21:41

    There is a difference in "printable" for "can be displayed on your screen". Your terminal displays the low ascii printer control codes 0x0B and 0x0C as the male and female symbols because that is what those indices in your font contain. Those characters are more accurately described as the Vertical Tabulator and Form Feed characters. These two characters, along with \t \r and \n, are all printable, and do well defined things on a printer.

提交回复
热议问题