Skip to content

Instantly share code, notes, and snippets.

@KKarthikeya
Created August 16, 2015 04:22
Show Gist options
  • Save KKarthikeya/59ef116923fe779b915c to your computer and use it in GitHub Desktop.
Save KKarthikeya/59ef116923fe779b915c to your computer and use it in GitHub Desktop.
Write code using find() and string slicing (see section 6.10) to extract the number at the end of the line below. Convert the extracted value to a floating point number and print it out.
text = "X-DSPAM-Confidence:0.8475"
epos = text.find(':')
print float(text[epos+1:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment