close
試用看看 find strip float max
text = " X-DSPAM-Confidence: 0.8475 "
text = text.strip()
lg=None
ll=None
for n in "01234567890":
l = text.find(n)
if l > 0:
if lg is None:
lg=l
if ll is None:
ll=l
lg=max(lg,l)
if l<ll:
ll=l
print float(text[ll:lg+1])
全站熱搜
留言列表