Read-Only Media: No Read-Only Volume: Not applicable (no file system)
Device Location: Internal Removable Media: Fixed
Solid State: Yes Virtual: No Hardware AES Support: Yes
$ diskutil info /dev/disk1 Device Identifier: disk1 Device Node: /dev/disk1 Whole: Yes Part of Whole: disk1 Device / Media Name: APPLE SSD AP0256M
Volume Name: Not applicable (no file system) Mounted: Not applicable (no file system) File System: None
Content (IOContent): EF57347C-0000-11AA-AA11-00306543ECAC OS Can Be Installed: No Media Type: Generic Protocol: PCI-Express SMART Status: Verified Disk / Partition UUID: 1DDCC569-2632-4CD5-88E7-66E2BBE745C9
root@UMU:~# python3 Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Python 3.7.6 (default, Feb 11 2020, 12:41:31) [GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license"for more information. >>>
## 打印的信息太长 i = 0 for m in sys.modules: i += 1 print('{0:2d} {1:32s} {2}'.format(i, m, sys.modules[m]))
## 不精准 i = 0 for m in sys.modules.values(): i += 1 if m.__spec__: v = m.__spec__.origin elif m.__builtins__: v = '-' else: v = '' print('{0:2d} {1:32s} {2}'.format(i, m.__name__, v))
## 推荐使用 i = 0 for m in sys.modules.values(): i += 1 s = str(m) start = s.find("'") end = s.find("'", start+1) k = s[start+1:end] start = s.find('from', end+1) if start > -1: start += 4 end = s.find('>', start+1) else: start = s.find('(', end+1) end = s.find(')', start+1) v = s[start+1:end] print('{0:2d} {1:28s} {2}'.format(i, k, v))
defnet_hex_to_ipv6(h): ipv6 = h[0:4] i = 4 while i < len(h): ipv6 += ':' + h[i:i+4] i += 4 return ipv6
withopen('/proc/net/if_inet6') as f: for line in f: p = line.split() if p[3] == '00'and (int(p[4], 16) & 0x80) != 0x80: ip = net_hex_to_ipv6(p[0]) print(ip) f.close()