diff --git a/README.md b/README.md index 916ae33..3dde6a8 100644 --- a/README.md +++ b/README.md @@ -895,8 +895,8 @@ JSON ---- ```python import json - = json.dumps(, ensure_ascii=True, indent=None) - = json.loads() + = json.dumps(, ensure_ascii=True, indent=None) + = json.loads() ``` #### To preserve order: @@ -920,6 +920,29 @@ def write_to_json_file(filename, an_object): ``` +Pickle +------ +```python +import pickle + = pickle.dumps() + = pickle.loads() +``` + +### Read Object from File +```python +def read_pickle_file(filename): + with open(filename, 'rb') as file: + return pickle.load(file) +``` + +### Write Object to File +```python +def write_to_pickle_file(filename, an_object): + with open(filename, 'wb') as file: + pickle.dump(an_object, file) +``` + + SQLite ------ ```python @@ -944,29 +967,6 @@ db.commit() ``` -Pickle ------- -```python -import pickle - = pickle.dumps() - = pickle.loads() -``` - -### Read Object from File -```python -def read_pickle_file(filename): - with open(filename, 'rb') as file: - return pickle.load(file) -``` - -### Write Object to File -```python -def write_to_pickle_file(filename, an_object): - with open(filename, 'wb') as file: - pickle.dump(an_object, file) -``` - - Exceptions ---------- ```python