Tab Character?

Ben Finney bignose+hates-spam at benfinney.id.au
Sat Feb 18 17:24:08 EST 2006


"tbonejo at gmail.com" <tbonejo at gmail.com> writes:
> How do I make a tab character in code to split a line read with tabs in
> it?

For such non-printing characters it's best not to have them literally
in your code, but to use an escape sequence to generate them at
run-time::

    >>> foo = "\t"
    >>> print foo

    >>> print ord(foo)
    9

This is explained in the "String literals" section of the Python
reference.

    <URL:http://docs.python.org/dev/ref/strings.html>

-- 
 \       "A celebrity is one who is known by many people he is glad he |
  `\                               doesn't know."  -- Henry L. Mencken |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list