title: Removing first character from string
body: <p>I am working on a CodeEval challenge and have a solution to a problem which takes a list of numbers as an input and then outputs the sum of the digits of each line. Here is my code to make certain you understand what I mean:</p>
  
  <pre><code>import sys
  test_cases = open(sys.argv[1], 'r')
  for test in test_cases:
      if test:
          num = int(test)
          total =0
          while num != 0:
              total += num % 10
              num /= 10
          print total
  
  
  test_cases.close()
  </code></pre>
  
  <p>I am attempting to rewrite this where it takes the number as a string, slices each 0-index, and then adds those together (curious to see what the time and memory differences are - totally new to coding and trying to find multiple ways to do things as well)</p>
  
  <p>However, I am stuck on getting this to execute and have the following:</p>
  
  <pre><code>import sys
  test_cases = open(sys.argv[1], 'r')
  for test in test_cases:
      sums = 0
      while test:
        sums = sums + int(str(test)[0])
        test = test[1:]
      print sums
  
  test_cases.close()
  </code></pre>
  
  <p>I am receiving a "ValueError: invalid literal for int() with base 10: ''"</p>
  
  <p>The sample input is a text file which looks like this:</p>
  
  <pre><code>3011
  6890
  8778
  1844
  42
  8849
  3847
  8985
  5048
  7350
  8121
  5421
  7026
  4246
  4439
  6993
  4761
  3658
  6049
  1177
  </code></pre>
  
  <p>Thanks for any help you can offer!</p>