Tutorial :Special Character Meanings Defined



Question:

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)?


Solution:1

\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.


Solution:2

\v is a vertical tab

\f is a formfeed

See: Escape Sequences


Solution:3

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).


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »