This commit is contained in:
chendelin1982 2021-10-11 20:23:46 +08:00
parent 08cd4d33cf
commit be8dbf112a
3 changed files with 12 additions and 19 deletions

1
cli/c2 Submodule

@ -0,0 +1 @@
Subproject commit 324c5bc05dd27826e863d31f2e3b0caf84878b2c

View file

@ -54,9 +54,6 @@ class FileOp:
def fileToJson(self, path: str, remark: Optional[str] = "#", separate: Optional[str] = "="):
''' convert file to Json '''
print(path)
dict = {}
with open(path) as fh:
for line in fh:
@ -65,6 +62,7 @@ class FileOp:
if line.find(remark) != 0:
item, value = line.strip().split(separate, -1)
if value != "":
dict[item] = value
else:
continue
@ -81,7 +79,7 @@ class NetOp:
def checkPort(self, port: int):
'''check the target port's status'''
search_key = "port="+str(port)
if str(psutil.net_connections()).find(search_key) != -1:
if str(+psutil.net_connections()).find(search_key) != -1:
print(str(port)+" is used")
return False
else:

View file

@ -1,16 +1,10 @@
class Card:
def __init__(self, rank, suit):
self.suit = suit
self.rank = rank
self.hard, self.soft = self._points()
import model,re
class NumberCard( Card ):
def _points(self):
return int(self.rank), int(self.rank)
env = {}
fileop=model.FileOp()
env = fileop.fileToJson('c2/.env')
class AceCard( Card ):
def _points(self):
return 1, 11
for key,value in env.items():
if re.match(pattern,key,re.I) != None:
print(value)
nc=NumberCard(11,12)
print(nc)