aboutsummaryrefslogtreecommitdiff
path: root/cheat/.cheat/python
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-02-14 12:46:55 +0100
committerneodarz <neodarz@neodarz.net>2019-02-14 12:47:21 +0100
commitbc3f5659576aa0d2803a4cd933079b1393537be5 (patch)
treefc9eb5aaf02c87f79823dc4f967cd22e2d5d44ca /cheat/.cheat/python
parent59367698d3127d1a8c43cfa42d4bee04b24965d8 (diff)
downloaddotfiles_ascii-bc3f5659576aa0d2803a4cd933079b1393537be5.tar.xz
dotfiles_ascii-bc3f5659576aa0d2803a4cd933079b1393537be5.zip
Update some tips
Diffstat (limited to '')
-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