Browse Source

System

pull/3/head
Jure Šorn 6 years ago
parent
commit
e7e22669e9
1 changed files with 6 additions and 4 deletions
  1. 10
      README.md

10
README.md

@ -742,6 +742,7 @@ import threading
```python
thread = threading.Thread(target=<function>, args=(<first_arg>, ))
thread.start()
...
thread.join()
```
@ -749,6 +750,7 @@ thread.join()
```python
lock = threading.Rlock()
lock.acquire()
...
lock.release()
```
@ -803,10 +805,10 @@ from itertools import *
>>> islice([1, 2, 3], 1, None) # islice(<seq>, from_inclusive, to_exclusive)
[2, 3]
>>> a = [{'id': 1, 'name': 'bob'},
{'id': 2, 'name': 'bob'},
{'id': 3, 'name': 'peter'}]
>>> {k: list(v) for k, v in groupby(a, key=lambda x: x['name'])}
>>> people = [{'id': 1, 'name': 'bob'},
{'id': 2, 'name': 'bob'},
{'id': 3, 'name': 'peter'}]
>>> {k: list(v) for k, v in groupby(people, key=lambda x: x['name'])}
{'bob': [{'id': 1, 'name': 'bob'},
{'id': 2, 'name': 'bob'}],
'peter': [{'id': 3, 'name': 'peter'}]}

Loading…
Cancel
Save