Skip to content

Commit dced859

Browse files
committed
ex 06
1 parent ddcb43f commit dced859

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ex_06_05.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
str = 'X-DSPAM-Confidence: 0.8475' # a random string
2+
3+
ipos = str.find(':') #find where ':' is located
4+
print(ipos) # printing the value of ipos: location of the ':'
5+
piece = str[ipos+1:]
6+
print(piece) # printing the string after the index position of ipos+1
7+
# print(piece+42.0) # will fail
8+
value = float(piece)
9+
print(value) # printing the float value
10+
print(value+42.0) # printing the float value with addition of 45.0
11+
piece = str[ipos+2:]
12+
print(piece) # printing the string after the index position of ipos+2

0 commit comments

Comments
 (0)