Guest User

Untitled

a guest
Apr 23rd, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. def fix_area(area):
  2.     mostprecise=0
  3.     try:
  4.         if area.count('e')==1:
  5.              return float(area)
  6.         if area.count('e')==2:
  7.             clean=area.replace("{", "")
  8.             clean2=clean.replace("}","")
  9.             help=clean2.split("|")
  10.             for a in help:
  11.                 if len(a)>mostprecise:
  12.                     mostprecise=len(a)
  13.             for b in help:
  14.                 if len(b)==mostprecise:
  15.                     return float(b)
  16.     except ValueError:
  17.         return None
Advertisement
Add Comment
Please, Sign In to add comment