loop
This commit is contained in:
parent
6afb15d260
commit
e45e9cb408
1 changed files with 10 additions and 14 deletions
24
package.py
24
package.py
|
@ -7,17 +7,13 @@ SEPARATOR = f'{os.linesep}{os.linesep}'
|
||||||
|
|
||||||
class Package:
|
class Package:
|
||||||
def __init__(self, package, files):
|
def __init__(self, package, files):
|
||||||
p = package.decode(CHARSET).strip()
|
for binary in [package, files]:
|
||||||
f = files.decode(CHARSET).strip()
|
text = binary.decode(CHARSET).strip()
|
||||||
text = f'{p}{SEPARATOR}{f}'
|
for item in text.split(SEPARATOR):
|
||||||
for item in text.split(SEPARATOR):
|
line, *lines = item.split(os.linesep)
|
||||||
line, *lines = item.split(os.linesep)
|
key = line.split(KEY)[1].lower()
|
||||||
key = line.split(KEY)[1].lower()
|
if len(lines) == 1:
|
||||||
if len(lines) == 1:
|
value = lines[0]
|
||||||
value = lines[0]
|
else:
|
||||||
else:
|
value = lines
|
||||||
value = lines
|
setattr(self, key, value)
|
||||||
setattr(self, key, value)
|
|
||||||
print()
|
|
||||||
print(key)
|
|
||||||
print(value)
|
|
||||||
|
|
Loading…
Reference in a new issue