Trying to map the 'Private IP' of my computer with python
<p>I want to filter the IPv4 ips and take the one which belong to my LAN (and not to my VMware network).
I coded this thing:</p>

<pre><code>print re.findall(r'[0-255]\.[0-255]\.[0-255]\.[0-255]', str([y for y in filter(lambda x: 'IPv4 Address' in x, os.popen("ipconfig").readlines())]))
</code></pre>

<p>This part:</p>

<pre><code>str([y for y in filter(lambda x: 'IPv4 Address' in x, os.popen("ipconfig").readlines())])
</code></pre>

<p>Its for getting first the ips I have (At least the row they are in.)
So for example, just this row, will give me:</p>

<blockquote>
  <p>['   IPv4 Address. . . . . . . . . . . : 192.168.231.1\n', '   IPv4
  Address. . . . . . . . . . . : 192.168.233.1\n', '   IPv4 Address. . .
  . . . . . . . . : 10.100.102.8\n']</p>
</blockquote>

<p>(The first two are of the VMware)</p>

<p>When I do the Regex thing, it isnt working. 
Its intended to give me just the ips from the string I gave it.</p>

<p>How can I filter the only LAN ip ('10.100.102.8' in this case.) and insert it to a string?</p>

<p>Watch out! <code>[0-255]</code> isn't a number range in regex ! (in fact it means <em>one</em> character in the list 0,1,2,5)</p>

<p>You should use <code>\d{1,3}</code> if you want a three digit number, then extract groups if you want to check if the number is in the range.</p>

python