Python: rename all files in a folder using numbers that file contain
<p>I want to write a little script for managing a bunch of files I got. Those files have complex and different name but they all contain a number somewhere in their name. I want to take that number, place it in front of the file name so they can be listed logically in my filesystem.</p>

<p>I got a <em>list</em> of all those files using os.listdir but I'm struggling to find a way to locate the numbers in those files. I've checked regular expression but I'm unsure if it's the right way to do this!</p>

<p>example:</p>

<pre><code>import os
files = os.litdir(c:\\folder)
files
['xyz3.txt' , '2xyz.txt', 'x1yz.txt']`
</code></pre>

<p>So basically, what I ultimately want is:</p>

<pre><code>1xyz.txt
2xyz.txt
3xyz.txt
</code></pre>

<p>where I am stuck so far is to find those numbers (1,2,3) in the list <em>files</em></p>
