|
Package parasol ::
Module cast'
|
|
1
2 __author__ = "Charlie Taylor (charlietaylor@sourceforge.net)"
3 __version__ = " 1.0 "
4 __date__ = "Jan 26, 2004"
5 __copyright__ = "Copyright (c) 2009 Charlie Taylor"
6 __license__ = "BSD"
7
8
10 """
11 converts input to an integer, no matter what.
12 returns an integer value, 0 if there's an error
13
14 @param val: value to be converted to an integer
15 """
16 try:
17 return int(val)
18 except:
19 return 0
20
22 """
23 converts input to a float, no matter what.
24 returns a float value, 0.0 if there's an error
25
26 @param val: value to be converted to a float
27 """
28 try:
29 return float(val)
30 except:
31 return 0.0
32