我目前有
".".join(str(z) for z in [int(x, 16) for x in (re.sub(r'(.{2})(?!$)', r'\1.', "00112233")).split('.')])
'xx.xx.xx.xx'
哪个有效,但是当我尝试通过 python -c 开关使用它时它失败了?
[root@monty ~]# python -c "import re ; ".".join(str(z) for z in [int(x, 16) for x in (re.sub(r'(.{2})(?!$)', r'\1.', "00112233")).split('.')])"
python -c "import re ; ".".join(str(z) for z in [int(x, 16) for x in (re.sub(r'(.{2})(?"import re ; ".".join(str(z) for z in [int(x, 16) for x in (re.sub(r'(.{2})(?python)', r'\1.', "00112233")).split('.')])")', r'\1.', "00112233")).split('.')])"
-bash: syntax error near unexpected token `str'
有任何想法吗 ?