python 3.x
I used the zipapp
module to create a pyz archive file.
If pyz contains a text file, how do I access it?
In the case of Java, I think I can read the text in the jar file, but is Python impossible?
Example
test.pyz
|-- |-- main.py
`-- a.txt
Perhaps you can use get_data from the pkgutil module or resource_stream from the pkg_resources module.
Please refer to this article.
python:can executable zip files include data files?
Way to access resource files impython
Python: Include data files in your own package
Using C-based Python modules in zipped Python directors
How to read a(static) file from inside a Python package?
© 2024 OneMinuteCode. All rights reserved.