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

前端 未结 2 1872
终归单人心
终归单人心 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:35

    From within cmd.exe:

    >>> print '\x0b'
    ♂
    >>> print '\x0c'
    ♀
    >>> print '\f' # form feed
    ♀
    >>> print '\v' # vertical tab
    ♂
    >>>
    

    Inside Emacs:

    >>> print '\f\v'
    ^L^K
    

    Here's an excerpt from formats(5)' man page:

    | Sequence | Character    | Terminal Action                             |
    |----------+--------------+---------------------------------------------|
    | \f       | form-feed    | Moves the printing position to the initial  |
    |          |              | printing position of the next logical page. |
    | \v       | vertical-tab | Moves the printing position to the start of |
    |          |              | the next vertical tab position. If there    |
    |          |              | are no more vertical tab positions left on  |
    |          |              | the page, the behavior is undefined.        |
    

提交回复
热议问题