-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
34 lines (26 loc) · 742 Bytes
/
Copy pathutils.py
File metadata and controls
34 lines (26 loc) · 742 Bytes
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
import pprint
import sys
import os
import json
import time
from pprint import pprint
import requests
from datetime import datetime
from dateutil import parser
import datetime
import numpy as np
def write_file(file, data):
with open(file, 'r+') as outfile:
outfile.write(data)
def write_file_noappend(file, data):
with open(file, 'w') as outfile:
outfile.write(data)
def read_file(file):
with open(file, 'r') as outfile:
return outfile.read()
def pp_json(json_thing, sort=True, indents=4):
if type(json_thing) is str:
print(json.dumps(json.loads(json_thing), sort_keys=sort, indent=indents))
else:
print(json.dumps(json_thing, sort_keys=sort, indent=indents))
return None