tab size

Gary Herron gherron at islandtraining.com
Mon Jun 17 12:56:55 EDT 2002


On Monday 17 June 2002 09:05 am, Alves, Carlos Alberto - Coelce wrote:
> Hi all,
>
> Consider the following code:
> >>> for i in range(10):
>
> 	print "%d\t"%i,
>
>
> 0	1	2	3	4	5	6	7	8	9
>
>
>
> How can I change the default size of tab in formating string \t?!

You can't.  In fact the question does not even make sense in this
context!  A tab has no size.  It is a single ascii character just like
any other ascii character.

However, when a string containing tabs is DISPLAYED, then the tabs are
expaned into some definite amount of space on the screen or paper or
wherever the display is occuring.

So to answer your question, we'd need to know where you are running
this:
  unix xterm?
  dos prompt?
  IDLE?
  emacs?
  ...?

Once you get the display of tabs to work as you wish in your setting,
you would still have the problem that running the program elsewhere
would expand the tabs according to other settings.  If you want FULL
control of the output wherever the thing is run, don't use tabs.


Dr.  Gary Herron







More information about the Python-list mailing list