使用find方法和字符串切片,提取出字符串中冒号后面的部分,然后使用float函数,将提取出来的字符串转换为浮点数 代码如下: 1234 text = "X-DSPAM-Confidence: 0.8475"pos = text.find(':')host = float(text[pos+1:])print host 赞微海报分享
近期评论