diff --git a/README.md b/README.md index 9aaff64c..46875af8 100644 --- a/README.md +++ b/README.md @@ -1782,9 +1782,9 @@ def read_json_file(filename): ### Write Collection to JSON File ```python -def write_to_json_file(filename, list_or_dict): +def write_to_json_file(filename, collection): with open(filename, 'w', encoding='utf-8') as file: - json.dump(list_or_dict, file, ensure_ascii=False, indent=2) + json.dump(collection, file, ensure_ascii=False, indent=2) ``` @@ -1798,14 +1798,14 @@ import pickle = pickle.loads() # Converts bytes object to object. ``` -### Read Object from File +### Read Object from Pickle File ```python def read_pickle_file(filename): with open(filename, 'rb') as file: return pickle.load(file) ``` -### Write Object to File +### Write Object to Pickle File ```python def write_to_pickle_file(filename, an_object): with open(filename, 'wb') as file: diff --git a/index.html b/index.html index cb29cbd8..10b709e1 100644 --- a/index.html +++ b/index.html @@ -55,7 +55,7 @@
- +
@@ -1481,9 +1481,9 @@ return json.load(file) -

Write Collection to JSON File

def write_to_json_file(filename, list_or_dict):
+

Write Collection to JSON File

def write_to_json_file(filename, collection):
     with open(filename, 'w', encoding='utf-8') as file:
-        json.dump(list_or_dict, file, ensure_ascii=False, indent=2)
+        json.dump(collection, file, ensure_ascii=False, indent=2)
 

#Pickle

Binary file format for storing Python objects.

import pickle
@@ -1492,12 +1492,12 @@
 
-

Read Object from File

def read_pickle_file(filename):
+

Read Object from Pickle File

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

Write Object to File

def write_to_pickle_file(filename, an_object):
+

Write Object to Pickle File

def write_to_pickle_file(filename, an_object):
     with open(filename, 'wb') as file:
         pickle.dump(an_object, file)
 
@@ -2931,7 +2931,7 @@

Format