Код: Выделить всё
enwiktionary_namespace_0_0.ndjson
enwiktionary_namespace_0_1.ndjson
enwiktionary_namespace_0_2.ndjson
...
enwiktionary_namespace_0_85.ndjson
Если файл .tar.gz содержит один файл .ndjson, то решение из этого ответа:
Код: Выделить всё
# Source - https://stackoverflow.com/a/79811790
# Posted by furas, modified by community. See post 'Timeline' for change history
# Retrieved 2025-11-07, License - CC BY-SA 4.0
import tarfile
import json
with tarfile.open("data.tar.gz", "r:gz") as tar:
data_file = tar.extractfile("data.ndjson")
for json_line in data_file:
html = json.loads(json_line)
print("html:", html)
# html = process_htm(html)
Подробнее здесь: https://stackoverflow.com/questions/798 ... ar-gz-file
Мобильная версия