This file contains 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
#100% working solution for python backgroud or python 3 | |
fname = input("Enter file name: ") | |
try: | |
fh = open(fname) | |
except: | |
print('file not found:error') | |
quit() | |
text=fh.read() |
This file contains 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
BEST TIME COMPLEXITY METHOD | |
text = "X-DSPAM-Confidence: 0.8475"; | |
atpos=text.find('0') | |
print(atpos) | |
sspos=text.find(' ',atpos) | |
print(sspos) | |
host=text[atpos : sspos] | |
print(float(host)) |