blob: fefb7fd482fa54317d9ac91aacd87d48261f6aef (
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):
"""
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, data):
"""
Simple wrapper for write data in file
Parameters
----------
filename : str
The filename where write the datas
data : str
The datas to write in the filename
"""
with open(filename, 'w') as file:
file.write(json.dumps(data))
return data
|