string to float helper

This commit is contained in:
Ruud
2012-02-05 15:04:21 +01:00
parent 856d0e0aa3
commit 1f16808002
+4
View File
@@ -78,6 +78,10 @@ def tryInt(s):
try: return int(s)
except: return s
def tryFloat(s):
try: return float(s) if '.' in s else tryInt(s)
except: return s
def natsortKey(s):
return map(tryInt, re.findall(r'(\d+|\D+)', s))