"tbonejo@gmail. com" <tbonejo@gmail. com> writes:[color=blue]
> How do I make a tab character in code to split a line read with tabs in
> it?[/color]
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::
[color=blue][color=green][color=darkred]
>>> foo = "\t"
>>> print foo[/color][/color][/color]
[color=blue][color=green][color=darkred]
>>> print ord(foo)[/color][/color][/color]
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
tbonejo@gmail.c om wrote:[color=blue]
> How do I make a tab character in code to split a line read with tabs in
> it?
>
>
> Thanks.
>
> Tom
>[/color]
You should also take a look at csv module. If you are reading lines
that contain tab delimeted data the csv module can make splitting very
easy.
Comment