Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # #!/usr/bin/python
- #
- # By dvdjaco
- # Exercise 6.5
- #
- # Take the following Python code that stores a string:
- # str = 'X-DSPAM-Confidence: 0.8475'
- # Use find and string slicing to extract the portion of the string after the colon character and then use the float function to convert the extracted string into a floating point number.
- string = 'X-DSPAM-Confidence: 0.8475'
- pos_colon = string.find(':')
- str_num = string[pos_colon + 1:]
- num = float(str_num)
- print num
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement