Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def convert_to_float(s):
- i_dot = -1
- for i in range(0,len(s)):
- if s[i] == "." or s[i] == ",":
- i_dot = i
- if i_dot == -1:
- if s.isdigit():
- return float(s)
- elif s[0:i_dot].isdigit() and s[i_dot+1:].isdigit():
- return float(s[0:i_dot] +"."+ s[i_dot+1:])
Add Comment
Please, Sign In to add comment