views:

46

answers:

3

In Python's module named string, there is a line that says whitespace = ' \t\n\r\v\f'.

  • ' ' is a space character.
  • '\t' is a tab character.
  • '\n' is a newline character.
  • '\r' is a carriage-return character.

  • '\v' maps to '\x0b' (11). What does it mean and how might it be typed on a keyboard (any OS)?
  • '\f' maps to '\x0c' (12). What does it mean and how might it be typed on a keyboard (any OS)?
+2  A: 

\v is a vertical tab

\f is a formfeed

See: Escape Sequences

Justin Ethier
+2  A: 

\v is a vertical tab. It was used in line printers to advance about 6 lines or so. It can be typed in *nix by pressing Ctrl-V Ctrl-K.

\f is a formfeed. It was used in line printers to advance to the next page. It can be typed in *nix by pressing Ctrl-V Ctrl-L.

Ignacio Vazquez-Abrams
+2  A: 

Per wikipedia:

12 (form feed, \f, ^L), to cause a printer to eject paper to the top of the next page, or a video terminal to clear the screen.

^L means Control-L on most keyboards and OSes.

\v, code 11 (typeable as ^K) is essentially obsolete, while ^L is still occasionally used (e.g in vi to "refresh/repaint the screen" rather than just "clearing" it as in the original meaning).

Alex Martelli