如果要构建自定义数据库,该怎么办? [英] If I want to build a custom database, how could I?

查看:67
本文介绍了如果要构建自定义数据库,该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个以前的程序,该程序接收了客户信息并将其存储在txt文件的文件夹中(实际上是不切实际的),但是现在我想对该程序进行升级以提高效率,并将该信息放入某种数据库中...

I built a previous program that took client info and stored it in a folder of txt files (impractical much) but now I want to upgrade the program to be more efficient and put the info into a database of some sort...

我如何从文本文件中获取信息并将其添加到新数据库中,而不必手动执行每个操作。我知道这很模糊,但是我需要更多的方法/逻辑,而不是确切的代码,此外,如果我不使用SQL,那么制作数据库的另一种方法(不使用其他商业Db)

How can I take the info from the text files and add them to the new database without having to manually do each one. I know this is vague but I need more so the method/logic instead of the exact code, Also if I don't use SQL what is another method for making a db (Not using another commercial Db)

btw txt文件采用简单的格式(名称,城市,年龄),它们都放在单独的行上,以便于迭代

btw the txt files are in simple format (name,city,age) all on separate lines for easy iteration

推荐答案

免费且可移植的Python shelve 模块可能就是您所需要的。它使您可以创建和使用本质上是永久性的字典,因此学习过程非常缓慢。将文本文件转换为一个文本文件应该相当容易,尽管它不是自动的-您可能需要编写一个简单的脚本来实现。

The free and portable Python shelve module in the standard library is probably all you need. It allows you to create and use what are essentially persistent dictionaries, so there's a very gradual learning curve. Converting your text files into one should be fairly easy, although won't be automatic -- you'll probably need to write a simple script to do it.

这篇关于如果要构建自定义数据库,该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆