我有一个MAC地址,我必须稍微操纵一下。
我希望将"FF:FF:FF:FF:FF:FF"
转换为"FF FF FF FF FF FF"
。
怎么做?
感谢您的回答!
答案 0 :(得分:0)
由于您提到拆分,首先拆分它然后加入它:
' '.join('FF:FF:FF:FF:FF:FF'.split(':'))
答案 1 :(得分:0)
如果是字符串,只需用空格替换所有:
个字符:
>>> mac = 'FF:FF:FF:FF:FF:FF'
>>> spacemac = mac.replace(':',' ')
>>> spacemac
'FF FF FF FF FF FF'