Preferred way to store/retrieve python data -


I would like to include data files with a Python package. The best place to place them inside the actual package is as suggested, i.e.

  setup.py src / mypkg / __init__.py module.py data / applause.com spoons.dat forks. Dat  

Or is there a better way to do this? What is the best way to recover datafile from within Python? For example, should I use

  mypkg.__ path__ + 'data / table data'  

 < Code> pkgutil.getdata ('mypkg', 'tables.dat')  

Or, is there a better way to do this?

Generally, what is the current preferred way of handling data inside Python packages?

pkgutil means that you can load the data even though you have installed the package in the zip file So, if you want to give that support then it would be better to store it in the data directory like I do this all the time :)


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -