@@ -46,11 +46,11 @@ list_of_chars = list(<str>)
46
46
```
47
47
48
48
``` python
49
- index = < list > .index(< el> ) # Returns first index of item.
49
+ index = < list > .index(< el> ) # Returns first index of item.
50
50
< list > .insert(index, < el> ) # Inserts item at index and moves the rest to the right.
51
51
< el> = < list > .pop([index]) # Removes and returns item at index or from the end.
52
52
< list > .remove(< el> ) # Removes first occurrence of item or raises ValueError.
53
- < list > .clear() # Removes all items.
53
+ < list > .clear() # Removes all items.
54
54
```
55
55
56
56
@@ -289,9 +289,9 @@ import re
289
289
```
290
290
291
291
* ** Parameter ` 'flags=re.IGNORECASE' ` can be used with all functions.**
292
- * ** Parameter ` 'flags=re.DOTALL' ` makes dot also accept newline.**
293
- * ** Use ` r'\1' ` or ` '\\1' ` for backreference.**
294
- * ** Use ` '?' ` to make operator non-greedy.**
292
+ * ** Parameter ` 'flags=re.DOTALL' ` makes dot also accept newline.**
293
+ * ** Use ` r'\1' ` or ` '\\1' ` for backreference.**
294
+ * ** Use ` '?' ` to make operator non-greedy.**
295
295
296
296
### Match Object
297
297
``` python
@@ -424,7 +424,7 @@ from itertools import product, combinations, combinations_with_replacement, perm
424
424
425
425
``` python
426
426
>> > product([0 , 1 ], repeat = 3 )
427
- [(0 , 0 , 0 ), (0 , 0 , 1 ), (0 , 1 , 0 ), (0 , 1 , 1 ),
427
+ [(0 , 0 , 0 ), (0 , 0 , 1 ), (0 , 1 , 0 ), (0 , 1 , 1 ),
428
428
(1 , 0 , 0 ), (1 , 0 , 1 ), (1 , 1 , 0 ), (1 , 1 , 1 )]
429
429
```
430
430
@@ -441,15 +441,15 @@ from itertools import product, combinations, combinations_with_replacement, perm
441
441
442
442
``` python
443
443
>> > combinations_with_replacement(' abc' , 2 )
444
- [(' a' , ' a' ), (' a' , ' b' ), (' a' , ' c' ),
445
- (' b' , ' b' ), (' b' , ' c' ),
444
+ [(' a' , ' a' ), (' a' , ' b' ), (' a' , ' c' ),
445
+ (' b' , ' b' ), (' b' , ' c' ),
446
446
(' c' , ' c' )]
447
447
```
448
448
449
449
``` python
450
450
>> > permutations(' abc' , 2 )
451
- [(' a' , ' b' ), (' a' , ' c' ),
452
- (' b' , ' a' ), (' b' , ' c' ),
451
+ [(' a' , ' b' ), (' a' , ' c' ),
452
+ (' b' , ' a' ), (' b' , ' c' ),
453
453
(' c' , ' a' ), (' c' , ' b' )]
454
454
```
455
455
@@ -505,7 +505,7 @@ from dateutil.tz import UTC, tzlocal, gettz
505
505
* ** ISO strings come in following forms: ` 'YYYY-MM-DD' ` , ` 'HH:MM:SS.ffffff[±<offset>]' ` , or both separated by ` 'T' ` .**
506
506
* ** On Unix systems Epoch is ` '1970-01-01 00:00 UTC' ` , ` '1970-01-01 01:00 CET' ` , ...**
507
507
508
- ### Decode
508
+ ### Decode
509
509
``` python
510
510
< str > = < D/ T/ DT > .isoformat() # ISO string representation.
511
511
< str > = < D/ T/ DT > .strftime(' <format>' ) # Custom string representation.
@@ -549,7 +549,7 @@ Splat Operator
549
549
``` python
550
550
args = (1 , 2 )
551
551
kwargs = {' x' : 3 , ' y' : 4 , ' z' : 5 }
552
- func(* args, ** kwargs)
552
+ func(* args, ** kwargs)
553
553
```
554
554
555
555
#### Is the same as:
@@ -677,7 +677,7 @@ creature = Creature()
677
677
Closure
678
678
-------
679
679
** We have a closure in Python when:**
680
- * ** A nested function references a value of its enclosing function and then**
680
+ * ** A nested function references a value of its enclosing function and then**
681
681
* ** the enclosing function returns the nested function.**
682
682
683
683
``` python
@@ -839,7 +839,7 @@ class MyComparable:
839
839
def __eq__ (self , other ):
840
840
if isinstance (other, type (self )):
841
841
return self .a == other.a
842
- return False
842
+ return False
843
843
```
844
844
845
845
### Hashable
@@ -857,7 +857,7 @@ class MyHashable:
857
857
def __eq__ (self , other ):
858
858
if isinstance (other, type (self )):
859
859
return self .a == other.a
860
- return False
860
+ return False
861
861
def __hash__ (self ):
862
862
return hash (self .a)
863
863
```
928
928
from enum import Enum, auto
929
929
930
930
class < enum_name> (Enum):
931
- < member_name_1> = < value_1>
931
+ < member_name_1> = < value_1>
932
932
< member_name_2> = < value_2_a> , < value_2_b>
933
933
< member_name_3> = auto()
934
934
@@ -1278,7 +1278,7 @@ Bytes
1278
1278
1279
1279
### Decode
1280
1280
``` python
1281
- < str > = < bytes > .decode(encoding = ' utf-8' )
1281
+ < str > = < bytes > .decode(encoding = ' utf-8' )
1282
1282
< int > = int .from_bytes(< bytes > , byteorder = ' big|little' , signed = False )
1283
1283
< hex > = < bytes > .hex()
1284
1284
```
@@ -1352,7 +1352,7 @@ Memory View
1352
1352
** Used for accessing the internal data of an object that supports the buffer protocol.**
1353
1353
1354
1354
``` python
1355
- < memoryview > = memoryview (< bytes > / < bytearray > / < array> )
1355
+ < memoryview > = memoryview (< bytes > / < bytearray > / < array> )
1356
1356
< memoryview > .release()
1357
1357
```
1358
1358
@@ -1494,7 +1494,7 @@ last_el = op.methodcaller('pop')(<list>)
1494
1494
```
1495
1495
1496
1496
1497
- Eval
1497
+ Eval
1498
1498
----
1499
1499
### Basic
1500
1500
``` python
@@ -1555,14 +1555,14 @@ def eval_node(node):
1555
1555
1556
1556
Coroutine
1557
1557
---------
1558
- * ** Similar to generator, but generator pulls data through the pipe with iteration, while coroutine pushes data into the pipeline with send().**
1559
- * ** Coroutines provide more powerful data routing possibilities than iterators.**
1560
- * ** If you built a collection of simple data processing components, you can glue them together into complex arrangements of pipes, branches, merging, etc.**
1558
+ * ** Similar to generator, but generator pulls data through the pipe with iteration, while coroutine pushes data into the pipeline with send().**
1559
+ * ** Coroutines provide more powerful data routing possibilities than iterators.**
1560
+ * ** If you built a collection of simple data processing components, you can glue them together into complex arrangements of pipes, branches, merging, etc.**
1561
1561
1562
1562
### Helper Decorator
1563
- * ** All coroutines must be "primed" by first calling next().**
1564
- * ** Remembering to call next() is easy to forget.**
1565
- * ** Solved by wrapping coroutines with a decorator:**
1563
+ * ** All coroutines must be "primed" by first calling next().**
1564
+ * ** Remembering to call next() is easy to forget.**
1565
+ * ** Solved by wrapping coroutines with a decorator:**
1566
1566
1567
1567
``` python
1568
1568
def coroutine (func ):
@@ -1691,7 +1691,7 @@ rotation=<int>|<datetime.timedelta>|<datetime.time>|<str>
1691
1691
retention= < int > | < datetime.timedelta> | < str >
1692
1692
```
1693
1693
* ** ` '<int>' ` - Max number of files.**
1694
- * ** ` '<timedelta>' ` - Max age of a file.**
1694
+ * ** ` '<timedelta>' ` - Max age of a file.**
1695
1695
* ** ` '<str>' ` - Max age as a string: ` '1 week, 3 days' ` , ` '2 months' ` , ...**
1696
1696
1697
1697
### Compression
0 commit comments