Skip to content

Commit 8971be4

Browse files
committed
Add "Relevant links" sections to various module documentation files for improved navigation
1 parent 4583da6 commit 8971be4

File tree

9 files changed

+94
-7
lines changed

9 files changed

+94
-7
lines changed

docs/modules/copy-module.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,15 @@ copy.deepcopy(x[, memo])
6161
#[[0], None, [3]]
6262
>>> b
6363
#[[1], [2], [3]]
64-
```
64+
```
65+
66+
## Relevant links
67+
68+
- <router-link to="/cheatsheet/oop-basics">Cheatsheet: OOP Basics</router-link>
69+
- <router-link to="/cheatsheet/lists-and-tuples">Cheatsheet: Lists and Tuples</router-link>
70+
- <router-link to="/cheatsheet/dictionaries">Cheatsheet: Dictionaries</router-link>
71+
- <router-link to="/blog/python-data-types">Blog: Python Data Types</router-link>
72+
- <router-link to="/builtin/object">object()</router-link>
73+
- <router-link to="/builtin/list">list()</router-link>
74+
- <router-link to="/builtin/dict">dict()</router-link>
75+
- <router-link to="/builtin/slice">slice()</router-link>

docs/modules/datetime-module.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,11 @@ And can subtract `days`, `seconds` and `microseconds` to a datetime object:
249249
>>> now - timedelta(days=10, seconds=15)
250250
# datetime.datetime(2022, 7, 13, 21, 59, 41, 100883)
251251
```
252+
253+
## Relevant links
254+
255+
- <router-link to="/cheatsheet/string-formatting">Cheatsheet: String Formatting</router-link>
256+
- <router-link to="/blog/python-data-types">Blog: Python Data Types</router-link>
257+
- <router-link to="/builtin/str">str()</router-link>
258+
- <router-link to="/builtin/format">format()</router-link>
259+
- <router-link to="/builtin/print">print()</router-link>

docs/modules/itertools-module.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: The itertools module is a collection of tools intended to be fast a
77
Python Itertools Module
88
</base-title>
99

10-
The _itertools_ module is a collection of tools intended to be fast and use memory efficiently when handling iterators (like [lists](#lists) or [dictionaries](#dictionaries-and-structuring-data)).
10+
The _itertools_ module is a collection of tools intended to be fast and use memory efficiently when handling iterators (like <router-link to="/cheatsheet/lists-and-tuples">lists</router-link> or <router-link to="/cheatsheet/dictionaries">dictionaries</router-link>).
1111

1212
<base-disclaimer>
1313
<base-disclaimer-title>
@@ -19,9 +19,7 @@ The _itertools_ module is a collection of tools intended to be fast and use memo
1919
</base-disclaimer-content>
2020
</base-disclaimer>
2121

22-
The _itertools_ module comes in the standard library and must be imported.
23-
24-
The [operator](https://docs.python.org/3/library/operator.html) module will also be used. This module is not necessary when using itertools, but needed for some of the examples below.
22+
The _itertools_ module comes in the standard library and must be imported. Some examples also use the `operator` module.
2523

2624
```python
2725
import itertools
@@ -511,3 +509,18 @@ Example:
511509
# (None, 9)
512510
# (None, 10)
513511
```
512+
513+
## Relevant links
514+
515+
- <router-link to="/cheatsheet/control-flow">Cheatsheet: Control Flow (for loops)</router-link>
516+
- <router-link to="/cheatsheet/lists-and-tuples">Cheatsheet: Lists and Tuples</router-link>
517+
- <router-link to="/cheatsheet/comprehensions">Cheatsheet: Comprehensions</router-link>
518+
- <router-link to="/cheatsheet/functions">Cheatsheet: Functions (Generators)</router-link>
519+
- <router-link to="/blog/python-comprehensions-step-by-step">Blog: Python Comprehensions Step-by-Step</router-link>
520+
- <router-link to="/builtin/iter">iter()</router-link>
521+
- <router-link to="/builtin/next">next()</router-link>
522+
- <router-link to="/builtin/map">map()</router-link>
523+
- <router-link to="/builtin/filter">filter()</router-link>
524+
- <router-link to="/builtin/zip">zip()</router-link>
525+
- <router-link to="/builtin/enumerate">enumerate()</router-link>
526+
- <router-link to="/builtin/range">range()</router-link>

docs/modules/json-module.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,13 @@ The other way around. The `dumps()` method transforms a Python object to a JSON
107107
>>> with open("filename.json", "w") as f:
108108
... f.write(json.dumps(person))
109109
```
110+
111+
## Relevant links
112+
113+
- <router-link to="/cheatsheet/json-yaml">Cheatsheet: JSON and YAML</router-link>
114+
- <router-link to="/cheatsheet/dictionaries">Cheatsheet: Dictionaries</router-link>
115+
- <router-link to="/cheatsheet/reading-and-writing-files">Cheatsheet: Reading and Writing Files</router-link>
116+
- <router-link to="/blog/python-data-types">Blog: Python Data Types</router-link>
117+
- <router-link to="/builtin/dict">dict()</router-link>
118+
- <router-link to="/builtin/str">str()</router-link>
119+
- <router-link to="/builtin/open">open()</router-link>

docs/modules/os-module.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Python Pathlib Module - Python Cheatsheet
2+
title: Python Os Module - Python Cheatsheet
33
description: This module provides a portable way of using operating system dependent functionality.
44
---
55

@@ -239,3 +239,12 @@ You can get a relative path from a starting path to another path.
239239
# The current folder is C:\delicious\walnut\waffles
240240
# FILE INSIDE C:\delicious\walnut\waffles: butter.txt
241241
```
242+
243+
## Relevant links
244+
245+
- <router-link to="/cheatsheet/file-directory-path">Cheatsheet: File & Directory Path</router-link>
246+
- <router-link to="/cheatsheet/reading-and-writing-files">Cheatsheet: Reading and Writing Files</router-link>
247+
- <router-link to="/blog/python-pathlib-essentials">Blog: Pathlib Essentials</router-link>
248+
- <router-link to="/modules/pathlib-module">Module: pathlib</router-link>
249+
- <router-link to="/builtin/open">open()</router-link>
250+
- <router-link to="/builtin/str">str()</router-link>

docs/modules/pathlib-module.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,10 @@ from pathlib import Path
256256
- Calling `Path.unlink()` will delete the file at path.
257257

258258
- Calling `Path.rmdir()` will delete the folder at path. This folder must be empty of any files or folders.
259+
260+
## Relevant links
261+
262+
- <router-link to="/cheatsheet/reading-and-writing-files">Cheatsheet: Reading and Writing Files</router-link>
263+
- <router-link to="/modules/os-module">Module: os</router-link>
264+
- <router-link to="/builtin/open">open()</router-link>
265+
- <router-link to="/builtin/str">str()</router-link>

docs/modules/random-module.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,12 @@ the `uniform` method is similar to `randint`, but return a floating point number
164164
>>> random.uniform(1, 5)
165165
# 3.0337059529999273
166166
```
167+
168+
## Relevant links
169+
170+
- <router-link to="/cheatsheet/lists-and-tuples">Cheatsheet: Lists and Tuples</router-link>
171+
- <router-link to="/blog/python-data-types">Blog: Python Data Types</router-link>
172+
- <router-link to="/builtin/list">list()</router-link>
173+
- <router-link to="/builtin/set">set()</router-link>
174+
- <router-link to="/builtin/int">int()</router-link>
175+
- <router-link to="/builtin/float">float()</router-link>

docs/modules/shelve-module.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,11 @@ Just like dictionaries, `shelf` values have `keys()` and `values()` methods that
4747
# ['wife']
4848
# [['Pretty', 'Lovely', 'Nice']]
4949
```
50+
51+
## Relevant links
52+
53+
- <router-link to="/cheatsheet/reading-and-writing-files">Cheatsheet: Reading and Writing Files</router-link>
54+
- <router-link to="/cheatsheet/dictionaries">Cheatsheet: Dictionaries</router-link>
55+
- <router-link to="/cheatsheet/context-manager">Cheatsheet: Context Managers</router-link>
56+
- <router-link to="/builtin/open">open()</router-link>
57+
- <router-link to="/builtin/dict">dict()</router-link>

docs/modules/zipfile-module.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Python Zipfile Module
1919
## Reading ZIP files
2020

2121
```python
22+
>>> import zipfile
23+
>>>
2224
>>> with zipfile.ZipFile('example.zip') as example_zip:
2325
... print(example_zip.namelist())
2426
... spam_info = example_zip.getinfo('spam.txt')
@@ -82,7 +84,7 @@ This code will create a new ZIP file named new.zip that has the compressed conte
8284
>>> import datetime
8385
>>> import zipfile
8486
>>>
85-
>>> with zipfile.ZipFile(archive_name) as zf:
87+
>>> with zipfile.ZipFile('example.zip') as zf:
8688
... for info in zf.infolist():
8789
... system = 'Windows' if info.create_system == 0 else 'Unix'
8890
... modified = datetime.datetime(*info.date_time)
@@ -102,3 +104,13 @@ This code will create a new ZIP file named new.zip that has the compressed conte
102104
# Compressed : 65 bytes
103105
# Uncompressed: 76 bytes
104106
```
107+
108+
## Relevant links
109+
110+
- <router-link to="/cheatsheet/reading-and-writing-files">Cheatsheet: Reading and Writing Files</router-link>
111+
- <router-link to="/cheatsheet/file-directory-path">Cheatsheet: File & Directory Path</router-link>
112+
- <router-link to="/cheatsheet/context-manager">Cheatsheet: Context Managers</router-link>
113+
- <router-link to="/modules/os-module">Module: os</router-link>
114+
- <router-link to="/modules/pathlib-module">Module: pathlib</router-link>
115+
- <router-link to="/builtin/open">open()</router-link>
116+
- <router-link to="/builtin/bytes">bytes()</router-link>

0 commit comments

Comments
 (0)