title: Extract first four digits from string within an list
body: <p>I have a list of folder names. Some names contain numbers only and others have the numbers prefixed before some text. </p>
  
  <p>Where the folder name contains both numbers and text, i would like to extract only the numbers (first four digits). </p>
  
  <pre><code>internal_list = [f.name for f in os.scandir(internal_path) if f.is_dir() ]
  print(internal_list)
  </code></pre>
  
  <p><code>internal_list</code> shows a list as follows </p>
  
  <pre><code>[1001 Support, 1021 Training, 1022, 1023, 1033 Procedures]
  </code></pre>
  
  <p>I would like internal_digits to show:</p>
  
  <pre><code>[1001, 1021, 1022, 1023, 1033] 
  </code></pre>
  
  <hr>
  
  <pre><code>internal_digits = []
  for filename in internal_list:
      if filename in '0123456789':
          internal_digits.append(filename[0:4])
  print (internal_digits)
  </code></pre>