1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
--- a/source/gennumber.py
+++ b/source/gennumber.py
@@ -44,7 +44,7 @@
except ValueError:
self.num = float(str(num))
- def setFromStr(self, numStr, strFormat='#\,###'):
+ def setFromStr(self, numStr, strFormat=r'#\,###'):
"""Set number value based on given format string.
Removes the extra characters from format and uses format's radix char.
@@ -65,7 +65,7 @@
return self
def numStr(self, strFormat='#.##'):
- """Return the number string in the given format, including exponents.
+ r"""Return the number string in the given format, including exponents.
Format:
# = optional digit
@@ -97,7 +97,7 @@
GenNumber(exp).basicNumStr(formExp))
def basicNumStr(self, strFormat='#.##'):
- """Return number string in the given format, without exponent support.
+ r"""Return number string in the given format, without exponent support.
Format:
# = optional digit
@@ -325,7 +325,7 @@
Arguments:
strFormat -- the string format to evaluate
"""
- if not '\,' in strFormat and ('\.' in strFormat or (',' in strFormat
+ if not r'\,' in strFormat and (r'\.' in strFormat or (',' in strFormat
and not '.' in strFormat)):
return ','
return '.'
@@ -338,5 +338,5 @@
strFormat - the string format to modify
"""
if radix == '.':
- return strFormat.replace('\,', ',')
- return strFormat.replace('\.', '.')
+ return strFormat.replace(r'\,', ',')
+ return strFormat.replace(r'\.', '.')
|