Created
July 5, 2016 03:53
-
-
Save zcakzwa/5882d461ed97829e068531282b32d7ec to your computer and use it in GitHub Desktop.
6.5 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text = "X-DSPAM-Confidence: 0.8475"; | |
t = text.find("0") | |
h = text[t:t+6] | |
h = float(h) | |
print h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
text = "X-DSPAM-Confidence: 0.8475"
a=text.find('0')
b=text.find('5')
c=text[a:b+1]
print(float(c))