title: Python expandtabs string operation
body: <p>I am learning about Python and got to the <code>expandtabs</code> command in Python.
  This is the official definition in the docs: </p>
  
  <blockquote>
  <pre><code>string.expandtabs(s[, tabsize])
  </code></pre>
    
    <p>Expand tabs in a string replacing them by one or more spaces, depending on  the current column and the given tab size. The column number is reset to zero after each newline occurring in the string. This doesn’t understand other non-printing characters or escape sequences. The tab size defaults to 8.</p>
  </blockquote>
  
  <p>So what I understood from that is that the default size of tabs is 8 and to increase that, we can use other values</p>
  
  <p>So, when I tried that in the shell, I tried the following inputs -</p>
  
  <pre><code>&gt;&gt;&gt; str = "this is\tstring"
  &gt;&gt;&gt; print str.expandtabs(0)
  this isstring
  &gt;&gt;&gt; print str.expandtabs(1)
  this is string
  &gt;&gt;&gt; print str.expandtabs(2)
  this is string
  &gt;&gt;&gt; print str.expandtabs(3)
  this is  string
  &gt;&gt;&gt; print str.expandtabs(4)
  this is string
  &gt;&gt;&gt; print str.expandtabs(5)
  this is   string
  &gt;&gt;&gt; print str.expandtabs(6)
  this is     string
  &gt;&gt;&gt; print str.expandtabs(7)
  this is       string
  &gt;&gt;&gt; print str.expandtabs(8)
  this is string
  &gt;&gt;&gt; print str.expandtabs(9)
  this is  string
  &gt;&gt;&gt; print str.expandtabs(10)
  this is   string
  &gt;&gt;&gt; print str.expandtabs(11)
  this is    string
  </code></pre>
  
  <p>So here,</p>
  
  <ul>
  <li><code>0</code> removes the tab character entirely,</li>
  <li><code>1</code> is exactly like the default <code>8</code>,</li>
  <li>but <code>2</code>is exactly like <code>1</code> and then</li>
  <li><code>3</code> is different</li>
  <li>and then again <code>4</code> is like using <code>1</code></li>
  </ul>
  
  <p>and after that it increases up till <code>8</code> which is the default and then increases after 8.But why the weird pattern in numbers from 0 to 8? I know it is supposed to start from 8, but what is the reason?</p>