-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.py
More file actions
25 lines (21 loc) · 752 Bytes
/
helpers.py
File metadata and controls
25 lines (21 loc) · 752 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
from __future__ import absolute_import, division, print_function
import os
try:
import cPickle as pickle
except:
import pickle
def dict_pickle(dict, name):
with open('{}.pickle'.format(name), 'wb') as handle:
pickle.dump(dict, handle, protocol=2)
handle.close()
def dict_unpickle(pickle_file):
with open('{}.pickle'.format(pickle_file), 'rb') as file:
pickle_dict = pickle.load(file)
file.close()
return pickle_dict
def del_pyc():
cur_dir = os.path.dirname(os.path.realpath(__file__))
for dirpath, dirnames, filenames in os.walk("."):
for filename in [f for f in filenames if f.endswith(".pyc")]:
os.remove(os.path.join(dirpath, filename))
#find . -name '*.pyc' -delete