FileIO

JSON

To dump data to json file:

output_path = <some_dir> / "some_file.json"
params = {'a': 1, 'b': 2}
with output_path.open('w') as f:
    json.dump(params, f, indent=4)  # `indent` writes each new input on a new line

to load from json file:

with input_path.open() as f:
    result = json.load(f)

shutil

shutil.copy(src_path, dst_path)
from shutil import copyfile, rmtree, move

CSV

import csv
def read_csv_file_into_dict(filename):
    with open(filename, newline='') as csvfile:
        reader = csv.reader(csvfile, delimiter=',')
        x = {row[0]: row[1] for row in reader}
    return x

Readline and Readlines

with open(f, "r") as f:
    a = f.readlines()