[Python-ideas] 'from os.path import FILE, DIR' or internal structure of filenames
p.f.moore at gmail.com
Sun Sep 29 20:16:59 CEST 2013
On 29 September 2013 18:39, anatoly techtonik <techtonik at gmail.com> wrote:
> With all -1 above, what is your preferred way to refer to resources
> that are places into subdirectories of your script directory?
If you are an imported module, pkgutil.get_data (because that handles
modules in zipfiles, etc). Otherwise, if you are running a single-file
with open(os.path.join(os.path.dirname(__file__), 'path', 'to', 'my',
'data')) as f:
data = f.read()
Why is this a problem?
More information about the Python-ideas