title: Truncating a string in python
body: <p>Someone gave me a syntax to truncate a string as follows:</p>
  
  <pre><code>string = "My Text String"
  
  print string [0:3] # This is just an example
  </code></pre>
  
  <p>I'm not sure what this is called (the string[0:3] syntax), so I've had a hard time trying to look it up on the internet and understand how it works. So far I think it works like this:</p>
  
  <ul>
  <li>string[0:3]  # returns the first 3 characters in the string</li>
  <li>string[0:-3] # will return the last 3 characters of the string</li>
  <li>string[3:-3] # seems to truncate the first 3 characters and the last 3 characters</li>
  <li>string[1:0]  # I returns 2 single quotes....not sure what this is doing</li>
  <li>string[-1:1] # same as the last one</li>
  </ul>
  
  <p>Anyways, there's probably a few other examples that I can add, but my point is that I'm new to this functionality and I'm wondering what it's called and where I can find more information on this. I'm sure I'm just missing a good reference somewhere.</p>
  
  <p>Thanks for any suggestions,
  Mike</p>