title: Python: extracting an integer from json using split
body: <p>I'm trying to extract the month number from dates in JSON files as an integer. The dates are formatted like this: <code>&quot;1990-12-01&quot;</code>
  The problem is that I'm getting extra characters that are incompatible with integers. I'm obviously missing something dumb. Here's an example of my output:</p>
  <pre><code>['12']
  </code></pre>
  <p>Here's my code:</p>
  <pre><code>f = open('data/file1.json')
  data = json.load(f)
  birthmonth = (data['people'][0]['birthDate'])
  newmonth = birthmonth.split('-')[1:2]
  print(newmonth)
  </code></pre>
  <p>And here's what the JSON looks like:</p>
  <pre><code>{
    &quot;copyright&quot; : &quot;All Rights Reserved.&quot;,
    &quot;people&quot; : [ {
      &quot;id&quot; : 84755,
      &quot;primaryNumber&quot; : &quot;21&quot;,
      &quot;birthDate&quot; : &quot;1990-12-01&quot;,
      &quot;currentAge&quot; : 29,
      &quot;active&quot; : true,
      &quot;currentRole&quot; : {
        &quot;id&quot; : 1,
        &quot;name&quot; : &quot;office&quot;
      },
      &quot;primaryBase&quot; : {
        &quot;code&quot; : &quot;R&quot;,
        &quot;name&quot; : &quot;Recall&quot;
      }
    } ]
  }
  </code></pre>
  <p>What can I do to produce output that's pure integers?
  Thanks,</p>