Skip to content Skip to sidebar Skip to footer

Python - Save Content Of A File Txt In A Db With Module Shelve

I have one text file called 'actors.txt' and 'actresses.txt'. This files weight 200MB and 100MB. I want save the content in a db doing 'import shelve'. The content is organized of

Solution 1:

Shelve is a terrible module (both slow and insecure), and you should never use it.

If you're looking for an easy-to-use in-memory (or file-backed) database that's part of the Python standard library, take a look at the sqlite3 module: http://docs.python.org/2/library/sqlite3.html

It's rock solid, powerful (it's a full-fledged SQL database), well-documented and remarkably fast.

EDIT: Also, as @roippi said, to actually read your files, you'll need to use the csv module: http://docs.python.org/2/library/csv.html

Post a Comment for "Python - Save Content Of A File Txt In A Db With Module Shelve"