1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #!/usr/bin/env python3 def getips(): import re import subprocess # get ip(s) from ifconfig found_ips = [] ips = re.findall( r'[0-9]+(?:\.[0-9]+){3}', subprocess.getoutput("/sbin/ifconfig")) for ip in ips: if ip.startswith("255") or ip.startswith("127") or ip.endswith("255"): continue found_ips.append(ip) return ", ".join(found_ips) |
2020-01-01
Python 3 Script to Get IPs (tested on RPI)
Subscribe to:
Post Comments (Atom)
-
Word for Windows with Merge Fields and problem during Print Preview ISSUE: Document merges normally and shows all the fields. When CTRL-P is...
-
Stop MS Edge from running in background when Edge is closed In MS Edge Navigate to: edge://settings/?search=startup Uncheck " Startup b...
-
Start|cmd|Right-Click|Run as administrator C:\Windows\system32 > powershell Windows PowerShell Copyright (C) 2009 Microsoft Corpor...
No comments:
Post a Comment