how to work with tab-delimited files?
Tim Chase
python.list at tim.thechases.com
Tue May 23 14:25:17 EDT 2006
> So in this situation, when the file is being read, is that
> single space still determined to be a tab, or do you have to
> press tab twice to put a full tab between the names?
If there is a literal tab in the file, it will come in (to your
code) as a real tab.
Your editor may have settings you can tweak to make it a little
more apparent. Vim (my preferred poison) allows you to
:set list
to see representations the literal tabs in your file. To turn it
off, do
:set nolist
You can also tweak your tabstops:
:set ts=12
(or whatever number/size accomodates your widest columns) which
would make a single tab character expand to your desired size.
This should help line matters up visually a little better.
Alternatively, with vim you can highlight the tabs to make them
stand out a bit more:
:match ErrorMsg /\t/
(or you can use another color instead of the ErrorMsg color...if
you hit <tab> after typing ":match ", it will successively show
you alternatives, or you can use ctrl+D to show a number of them)
Just a few ideas with a vim spin. Other quality editors should
support similar functionality.
-tkc
More information about the Python-list
mailing list