blob: b92d2b9709cac086fa542249f8648ec512780f20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
def read_file(filename: str) -> str:
"""
Simple wrapper for read a file content
Parameters
----------
filename : str
The filename where read the datas
"""
with open(filename, 'r') as file:
data = file.read()
return data
def write_file(filename: str, datas: str) -> str:
"""
Simple wrapper for write data in file
Parameters
----------
filename : str
The filename where write the datas
datas : str
The datas to write in the filename
"""
with open(filename, 'w') as file:
file.write(json.dumps(datas))
return datas
|