diff --git a/README.md b/README.md index 8c28b93..a7bfed4 100644 --- a/README.md +++ b/README.md @@ -1682,6 +1682,8 @@ b'.\n..\nfile1.txt\nfile2.txt\n' JSON ---- +**Text file format for storing collections of strings and numbers.** + ```python import json = json.dumps(, ensure_ascii=True, indent=None) @@ -1705,6 +1707,8 @@ def write_to_json_file(filename, an_object): Pickle ------ +**Binary file format for storing objects.** + ```python import pickle = pickle.dumps() diff --git a/index.html b/index.html index 284c06d..6b1fa5b 100644 --- a/index.html +++ b/index.html @@ -1518,11 +1518,12 @@ shutil.copytree(from, to) # Copies the enti 0 -

#JSON

import json
+

#JSON

Text file format for storing collections of strings and numbers.

import json
 <str>    = json.dumps(<object>, ensure_ascii=True, indent=None)
 <object> = json.loads(<str>)
 
+

Read Object from JSON File

def read_json_file(filename):
     with open(filename, encoding='utf-8') as file:
         return json.load(file)
@@ -1533,11 +1534,12 @@ shutil.copytree(from, to)           # Copies the enti
         json.dump(an_object, file, ensure_ascii=False, indent=2)
 
-

#Pickle

import pickle
+

#Pickle

Binary file format for storing objects.

import pickle
 <bytes>  = pickle.dumps(<object>)
 <object> = pickle.loads(<bytes>)
 
+

Read Object from File

def read_pickle_file(filename):
     with open(filename, 'rb') as file:
         return pickle.load(file)