-
Notifications
You must be signed in to change notification settings - Fork 0
/
coins.py
45 lines (40 loc) · 1.21 KB
/
coins.py
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
37
38
39
40
41
42
43
44
45
import pickle
class coin(object):
def __init__(self, coin_name, config_file, configfolder, daemon, cli, repo, port): #add_date, website, discord
self.name = coin_name
self.config_file = config_file
self.configfolder = configfolder
self.daemon = daemon
self.cli = cli
self.repo = repo
self.port = port
#self.add_date = add_date
#self.website = website
#self.discord = discord
#self.explorer = explorer
def read_coins(tab):
try:
f = open(tab + "_coins.dat", "rb")
coinsz = pickle.load(f)
except:
f = open(tab + "_coins.dat", "wb")
coinsz = []
f.close()
return coinsz
def add_coin(added_coin, tab):
coins = read_coins(tab)
coins.append(added_coin)
f = open(tab + "_coins.dat", "wb")
pickle.dump(coins, f)
f.close()
def del_coin(deleted_coin):
new_coins = []
coinsz = read_coins(tab = "abu")
for i in coinsz:
if i.name == deleted_coin:
pass
else:
new_coins.append(i)
f = open("abu_coins.dat", "wb")
pickle.dump(new_coins, f)
f.close()