Merge pull request 'Refactoring' (#1) from a2p1k02/fb3test:master into master

Reviewed-on: http://git.macaw.me:3000/SiberiaBreadFactory/fb3test/pulls/1
This commit is contained in:
SiberiaBreadFactory 2021-01-01 18:49:15 +00:00
commit e5b215f635
7 changed files with 16 additions and 17 deletions

10
.idea/fb3test.iml generated
View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.9 (fb3test)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,7 +0,0 @@
from zipfile import ZipFile
from bs4 import BeautifulSoup
from lxml import etree
with ZipFile('1.fb3') as book:
for row in book.read('fb3/body.xml').decode('utf-8').splitlines():
print(row)

BIN
src/1.fb3 Normal file

Binary file not shown.

BIN
src/fb3_reader/1.fb3 Normal file

Binary file not shown.

BIN
src/fb3_reader/__init__.py Normal file

Binary file not shown.

12
src/fb3_reader/fb3.py Normal file
View File

@ -0,0 +1,12 @@
import sys
from zipfile import ZipFile
# from bs4 import BeautifulSoup
# from lxml import etree
def reader():
files = input("Enter the path to file: ")
with ZipFile(files) as book:
for row in book.read('2/fb3/body.xml').decode('utf-8').splitlines():
opened = open("test.txt", "a")
opened.write(row)

4
src/main.py Normal file
View File

@ -0,0 +1,4 @@
from fb3_reader import fb3
if __name__ == '__main__':
fb3.reader()