package
This commit is contained in:
parent
82f5290c18
commit
6afb15d260
2 changed files with 38 additions and 3 deletions
24
package.py
24
package.py
|
@ -1,3 +1,23 @@
|
|||
import os
|
||||
|
||||
CHARSET = 'u8'
|
||||
KEY = '%'
|
||||
SEPARATOR = f'{os.linesep}{os.linesep}'
|
||||
|
||||
|
||||
class Package:
|
||||
def __init__(self):
|
||||
pass
|
||||
def __init__(self, package, files):
|
||||
p = package.decode(CHARSET).strip()
|
||||
f = files.decode(CHARSET).strip()
|
||||
text = f'{p}{SEPARATOR}{f}'
|
||||
for item in text.split(SEPARATOR):
|
||||
line, *lines = item.split(os.linesep)
|
||||
key = line.split(KEY)[1].lower()
|
||||
if len(lines) == 1:
|
||||
value = lines[0]
|
||||
else:
|
||||
value = lines
|
||||
setattr(self, key, value)
|
||||
print()
|
||||
print(key)
|
||||
print(value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue