@@ -41,9 +41,9 @@ Besides that, you have the following imports avaiable:
41
41
42
42
So you can do:
43
43
44
- Counter(('Ann', 'Bob', 'Bob', 'Michael')) = Counter({'Bob': 2, 'Ann': 1, 'Michael': 1})
45
- Counter(('Ann', 'Bob', 'Bob', 'Michael', 'michael')) = Counter({'Bob': 2, 'Ann': 1, 'michael': 1, 'Michael': 1})
46
- Counter(name.title() for name in ('Ann', 'Bob', 'Bob', 'Michael', 'michael')) = Counter({'Bob': 2, 'Michael': 2, 'Ann': 1})
44
+ Counter(('Ann', 'Bob', 'Bob', 'Michael')) -> Counter({'Bob': 2, 'Ann': 1, 'Michael': 1})
45
+ Counter(('Ann', 'Bob', 'Bob', 'Michael', 'michael')) -> Counter({'Bob': 2, 'Ann': 1, 'michael': 1, 'Michael': 1})
46
+ Counter(name.title() for name in ('Ann', 'Bob', 'Bob', 'Michael', 'michael')) -> Counter({'Bob': 2, 'Michael': 2, 'Ann': 1})
47
47
48
48
### Computing checksums
49
49
@@ -55,9 +55,9 @@ The python `hashlib.md5` and `hashlib.sha1` functions are avaiable under the nam
55
55
56
56
The functions ` dnow ` , ` tnow ` and ` dtnow ` return respectively the current string-formatted date, time and datetime:
57
57
58
- dnow() = 03/05/2017
59
- tnow() = 09:36:03
60
- dtnow() = 03/05/2017 09:36:03
58
+ dnow() -> 03/05/2017
59
+ tnow() -> 09:36:03
60
+ dtnow() -> 03/05/2017 09:36:03
61
61
62
62
Notice that you need to have parenthesis after the function name to invoke the function call.
63
63
@@ -68,12 +68,12 @@ While you can just use the regular python to do set computations, there's a few
68
68
69
69
The functions takes two iterable arguments, which are turned into sets, and the computations are performed:
70
70
71
- set_intersect('foo bar', 'foo baz') = {'b', 'a', ' ', 'o', 'f'}
72
- set_intersect('foo baz', 'foo bar') = {'b', 'a', ' ', 'o', 'f'}
73
- set_difference('foo baz', 'foo bar') = {'z'}
74
- set_difference('foo bar', 'foo baz') = {'r'}
75
- set_symdiff('foo baz', 'foo bar') = {'z', 'r'}
76
- set_symdiff('foo bar', 'foo baz') = {'z', 'r'}
71
+ set_intersect('foo bar', 'foo baz') -> {'b', 'a', ' ', 'o', 'f'}
72
+ set_intersect('foo baz', 'foo bar') -> {'b', 'a', ' ', 'o', 'f'}
73
+ set_difference('foo baz', 'foo bar') -> {'z'}
74
+ set_difference('foo bar', 'foo baz') -> {'r'}
75
+ set_symdiff('foo baz', 'foo bar') -> {'z', 'r'}
76
+ set_symdiff('foo bar', 'foo baz') -> {'z', 'r'}
77
77
78
78
79
79
### Formatting numbers
@@ -93,18 +93,18 @@ scientificNotation
93
93
94
94
Example usage:
95
95
96
- formatnum(0.123456789, 4) = 0.1235
97
- formatnum(0.123456789, 9) = 1.234567890e-01
98
- formatnum(123456789.0, 9) = 1.234567890e+08
99
- formatnum(123456789.0, 2) = 1.23e+08
100
- formatnum(123.456789, 12) = 1.234567890000e+02
101
- formatnum(123.456789, 12, False) = 123.456789000000
102
- formatnum(123.456789, 3) = 123.457
103
- formatnum(3.14159, 4) = 3.1416
104
- formatnum(3.14159, 3) = 3.142
105
- formatnum(3.14159, 2) = 3.14
106
- formatnum(3.14159, 2, True) = 3.14e+00
107
- formatnum(3.141592653589793238462643383279502884197169399375105820974944 , 3) = 3.142
96
+ formatnum(0.123456789, 4) -> 0.1235
97
+ formatnum(0.123456789, 9) -> 1.234567890e-01
98
+ formatnum(123456789.0, 9) -> 1.234567890e+08
99
+ formatnum(123456789.0, 2) -> 1.23e+08
100
+ formatnum(123.456789, 12) -> 1.234567890000e+02
101
+ formatnum(123.456789, 12, False) -> 123.456789000000
102
+ formatnum(123.456789, 3) -> 123.457
103
+ formatnum(3.14159, 4) -> 3.1416
104
+ formatnum(3.14159, 3) -> 3.142
105
+ formatnum(3.14159, 2) -> 3.14
106
+ formatnum(3.14159, 2, True) -> 3.14e+00
107
+ formatnum(3.141592653589793238462643 , 3) -> 3.142
108
108
109
109
110
110
## Usage
0 commit comments