title: 'long' object has no attribute '__getitem__' Error
body: <p>I am writing a function to help out our test department put random phone numbers into a phone number field. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>from random import randrange
  
  def phonenumbergenerator():
      phonenumber = randrange(1111111111, 9999999999)
      phonenumberformatted = (str("%s-%s-%s" % (phonenumber[:3], phonenumber[3:6], phonenumber[6:])))
      return phonenumberformatted
  
  print phonenumbergenerator()
  </code></pre>
  
  <p>I am getting the following error when I try to run this and I am not sure what I am doing incorrectly here:</p>
  
  <p><code>TypeError: 'long' object has no attribute '__getitem__'</code></p>