aboutsummaryrefslogtreecommitdiff
path: root/cheat/.cheat/python
diff options
context:
space:
mode:
Diffstat (limited to 'cheat/.cheat/python')
-rw-r--r--cheat/.cheat/python25
1 files changed, 25 insertions, 0 deletions
diff --git a/cheat/.cheat/python b/cheat/.cheat/python
index e4f5d36..4428b48 100644
--- a/cheat/.cheat/python
+++ b/cheat/.cheat/python
@@ -17,3 +17,28 @@ python -mjson.tool
# Generate requirements.txt
pipreqs /path/to/project
+
+# Tips
+# Ressources available in : cheat python_ressources
+
+Input: décoder avec `decode()`.
+Output: encoder avec `encode('utf-8')`
+
+lors de l'ouverture d'un fichier:
+```
+from codecs import open
+
+# open() de codec à exactement la même API, y compris avec "with"
+f = open('fichier', encoding='encoding')
+```
+
+# Types
+
+bytes == bytearray
+
+# non mutable (non modifiable)
+bytes
+tuple
+
+# mutable (modifiable)
+bytearray